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 :(

5 Years
Discussion Span
Last Post by momonq1990

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


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

$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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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;">
            <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>

    <table style="border-style:solid; border-width:1px; border-color:#d9d8d8; border-bottom:none; width:530px; height:250px; background:#FFF;">  
            <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 

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>

    <table style="font-family:arial; font-size: 11px;border-style:solid; border-width:1px;border-color:#d9d8d8; width:530px; background:#FFF;">  
            <td style="padding:8px 25px;"><a href="http://www.domain.com/" style="color:#666666; text-decoration:none;">www.domain.com</a></td>  
   <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>


$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?

Edited by momonq1990


:) 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?


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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.