Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

insert image in mail body

How to insert image in mail body when user click on send button. I am using php mail

like image 236
ZEESHAN IQBAL Avatar asked Mar 22 '11 11:03

ZEESHAN IQBAL


People also ask

How do I paste a picture into the body of an Outlook email?

In modern Outlook, right-click on the image and choose 'Save as Picture …'. This is the same feature as in Word since Office 2010 for saving images in documents. Save as Picture saves the image to a separate file. Then paste into an image editor like Paint, Photoshop or whatever you prefer.


1 Answers

To create an HTML email you can do something like this:

...
$message = "<html><head></head><body>";
$message .= "<img src='link-image.jpg' alt='' /></body></html>";

$headers = "From: $from_email";
$headers .= "Content-type: text/html";

mail($to, $subject, $message, $headers);

This should build an HTML email for you and you should then be able to insert just normal html.

edit You can read more about how to create HTML emails using PHP from here: http://css-tricks.com/sending-nice-html-email-with-php/

like image 79
sarcastyx Avatar answered Oct 13 '22 22:10

sarcastyx