9

I have created a base64 image to be sent via email to the customer on there mobile device It works in the email app but the gmail app shows a missing image

Is that just google mail blocking data images for security? There's no button to show images either

Code:

    $headers = "From: info@mydomain.com\r\n";
    $headers .= "Reply-To: info@mydomain.com\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$imagedata = file_get_contents("http://www.barcodesinc.com/generator/image.php? code=12345&style=68&type=C128B&width=180&height=70&xres=1&font=1");
$base64 = base64_encode($imagedata);
$message ="<img src='data:image/png;base64,$base64'>";

mail($to,$subject,$message,$headers);</pre>
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
likdaboo
  • 180
  • 1
  • 1
  • 11
  • See http://stackoverflow.com/questions/3279523/base64-images-to-gmail/12786336#12786336. Not sure if its still works, most likely will though. – SamV Sep 09 '13 at 22:37
  • @Dagon I have added the code and Sam I do not understand how to use that code, as I am very basic with PHP emails – likdaboo Sep 12 '13 at 00:11
  • bares no resemblance to sending email with an embedded image that i have ever seen. –  Sep 12 '13 at 00:16

2 Answers2

5

It's google blocking images. Google striped out most inline css and other 'likely' vulnerablilities that cause harm to the end-users' system. Unfortunatly this is the case. However i still think you should never embed your images in e-mail, because you have a lot of mobile users with dataplans. Seems a bit rude.

Benjamin de Bos
  • 4,334
  • 4
  • 20
  • 30
1

Google is blocking images. Reference: 2013 test from Campaign Monitor on Embedded image support in HTML email.

mikemaccana
  • 110,530
  • 99
  • 389
  • 494