How do I display images in an email using the mail()
function in PHP?
Does putting <img src="image path" />
work?
How do I display images in an email using the mail()
function in PHP?
Does putting <img src="image path" />
work?
You need to set the headers to tell it that it's HTML. You can do this by:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
and then send with
mail($to, $subject, $message, $headers);
so you pass the headers as a string to the 4th parameter of mail()
.
You should set the relevant character encoding in charset
, and also provide a text version if this is going to end users.
Try sending the mail as html. Look at this http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php