Jump to content

Email Image Using PHP


stevesimo

Recommended Posts

Hi, I have a script which sends and email to a given email address.  This works fine however I want to also embed an image into the email.  Does anyone know if this is possible and if so how do I achieve it.

 

Here is my email code:

 

  $to = $useremail;
  $subject = "Email Subject";
  $body = "My email content";
  mail($to, $subject, $body);

 

Many thanks,Steve

Link to comment
https://forums.phpfreaks.com/topic/100484-email-image-using-php/
Share on other sites

Hi Steve,

 

Its possible.

 

First you need to modify the headers to instruct the email client to interpret the email as HTML, then include the relevant HTML tags to display the picture hosted on your server.

 

You can also sent the email with the picture as an attachment.

 

Remeber that not all email clients interpret HTML either by default or at all so you have to encode the email to be sent as HTML and plain text.

 

There is a great article by Kevin Yank at sitepoint that will guide you through it.

 

http://www.sitepoint.com/article/advanced-email-php/

 

Cheers,

Matt

Archived

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

×
×
  • Create New...

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.