Jump to content


This topic is now archived and is closed to further replies.


Graphics in php Email

Recommended Posts

Can anyone help me to include graphics in my php emails, currently I can only submit text, I would also like to be able to choose a text rather than just Time New Roman.
The current script is:

$headers = "MIME-Version: 1.0\n";
                                $headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $from\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
mail($to, $subject, $message, $headers);

Thanks in advance to anyone who can help

Share this post

Link to post
Share on other sites
This would be just normal HTML tags in your message
image example
<img src="http://www.domain.com/images/image.gif" border="0" alt="" />
Make sure you use a full path (http://....)

for different font, just change the style
<div style="font-family:arial; font-size:9pt;">

Share this post

Link to post
Share on other sites
Hi blackerutuf

You have to send the email as HTML, and then specify images etc. within the HTML.

www.php.net says...

// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
  <title>Birthday Reminders for August</title>
  <p>Here are the birthdays upcoming in August!</p>

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?> [/code]

The important bits there are that you should include

[quote]$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";[/quote]

within your headers and also lay out the email as a html page

Hope that helps


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.