how can i send mail with working .gif, .png and background color using mail()function.

what i need to set? i have
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

pls help what i need to do :(

Recommended Answers

All 8 Replies

Just create a valid HTML file, but keep in mind that the images need to be attached, or you need to specify valid publicly accessible URLs.

i just want to Quote this from php.net

"If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package » PEAR::Mail_Mime."

that is that pear mail_mime? its php code?

and pls correct me if im wrong with
valid publicly accessible URLs. = www.mydomain.com/img.jpg

and the other one, how to use the attached images to design email html. :)

that is that pear mail_mime? its php code?

It is a PHP package from PEAR, a repository of tools.

valid publicly accessible URLs. = www.mydomain.com/img.jpg

Correct.

how to use the attached images to design email html

See the manual for mail, at the bottom see the following comment: jdephix at hotmail dot com02-Mar-2005 12:25

<?php
$to  = 'recver@gmail.com';
$subject = 'Notification message!';
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Message</title>
</head>
<body bgcolor="#000">
    <span style="position:absolute; left:430px;"><img src="email/message/image/red.png" /> </span>
    <table style="border-style:solid; border-width:1px; border-color:#d9d8d8; border-bottom:none; width:530px; height:73px; background:url(email/message/image/gray.gif) repeat-x;">
        <tr> 
            <td style="padding:4px 25px; color:#666666;">
                <pre style="font-family:arial; font-size: 12px; line-height:1.5em;">
<b style="color:#333;">Raymond </b>
Greetings</pre>
            </td> 
        </tr>  
    </table>  

    <table style="border-style:solid; border-width:1px; border-color:#d9d8d8; border-bottom:none; width:530px; height:250px; background:#FFF;">  
        <tr>  
            <td><pre style="font-family:arial; font-size: 12px;  line-height:1.4em; padding:10px 25px; color:#666666;">
Thank you 
for using message us 
from our website,
<a href="http://www.domain.com/" style="color:#666666; text-decoration:none;">www.domain.com</a>

This email is to confirm the receipt of your online message for us. 
For your concern, we will get in touch you within 24 hours and 
expect a follow-up private emails or call from one of our 
representatives.

Thank you so much and have a great day! 
<a href="http://www.domain.com/" style="color:#666666; text-decoration:none;">message@domain.com</a>
</pre>
            </td>  
        </tr>  
    </table>

    <table style="font-family:arial; font-size: 11px;border-style:solid; border-width:1px;border-color:#d9d8d8; width:530px; background:#FFF;">  
        <tr>  
            <td style="padding:8px 25px;"><a href="http://www.domain.com/" style="color:#666666; text-decoration:none;">www.domain.com</a></td>  
        </tr>  
    </table>    
   <span style="font-family:arial; font-size: 10px; color:#CCC; display:block; padding:10px 0 10px 25px;">cannot view this email? <a href="#" style="color:#CCC;">view here</a>.</span>
</body>
</html>

';

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: customer service. <message@domain.com>' . "\r\n";
mail($to, $subject, $message, $headers);
?>

this is my code. its work but when i recieved in yahoo and gmail there is no images worked as well as bgcolor..... :(

it is ok to put the doctype inside? or just plain html?

:) ahahah yes. its work. so nice and cute :D thank you again sir! when i finished this project i will give u the link:D but sir last thing my position:absolute is not work inside the tbl. what do u think?

Not all CSS is supported by every and all e-mail clients. If you want professional help with that I can recommend Litmus.

ill try that sir :d thank you! .. :) :) mark this as solved by pritaeas :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.