1

I send HTML emails with PHP's mail() function with this header:

$header  = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";

Now, I want to embed an image. Should I just simply do that as simple as this?

<img src="http://www.example.de/images/image.png" alt="test" title="test" />

With this, a warning is shown if you open the email in Outlook etc., that images from an external server are embedded. Is it possible/better to use base64 encode like this?

<img src="data:image/png;base64,..." alt="test" title="test" />

Or are data URIs not supported by mail programs widely?


EDIT: Thank you for voting for close, because this question is "opinion-based". I do not think so, because I asked for this:

Or are data URIs not supported by mail programs widely?

I need a possibility for sending images in emails without loading them from my server. And I just want to know of any disadvantages or other methods.

Richard
  • 2,840
  • 3
  • 25
  • 37
  • I've found similar question http://stackoverflow.com/questions/9110091/base64-encoded-images-in-email-signatures – hywak May 20 '15 at 14:33
  • possible duplicate of [How to embed images in email](http://stackoverflow.com/questions/4312687/how-to-embed-images-in-email) – r3mainer May 20 '15 at 15:14

1 Answers1

1

Data URI's are supported in some email clients.

The best way to include images in your HTML email is probably to include them as separate parts, referenced by their content id:

<img src="cid:123456789" alt="Attached image">

Also have a look at this thread

Community
  • 1
  • 1
Simon
  • 3,667
  • 1
  • 35
  • 49