0

I am trying to send an email with a screenshot as the body of an email. Normal text mail is being sent without any problem. screenshot.png is the image which I want to send.

<?php
  $to=$cust_email; 
  $cartTotal=$_SESSION["cartTotal"];
  $message = '<img src="screenshot.png">';
  mail($to,'Bill',$message,'FROM:xyz@gmail.com');
?>

I've also tried:

<?php
  $to=$cust_email; 
  $cartTotal=$_SESSION["cartTotal"];
  $message = '<img src="screenshot.png">';
  mail($to,'Bill','echo \'<img src="screenshot.png"/>\';','FROM:xyz@gmail.com');
?>
pilsetnieks
  • 10,330
  • 12
  • 48
  • 60
user2280276
  • 125
  • 1
  • 2
  • 7
  • 1
    You'll need to look into sending a HTML email, rather than a plaintext one. You'll also need to include the image as an attachment. – andrewsi Apr 18 '13 at 17:10
  • is it not possible without the inclusion of an attatchment?coz we get so many mails with images in them! – user2280276 Apr 18 '13 at 17:12
  • 1
    You can link to it on a web server (``), but a lot of mail clients won't automatically display those. – andrewsi Apr 18 '13 at 17:14
  • Here is the solution ... [stackoverflow][1] [1]: http://stackoverflow.com/questions/5390138/insert-image-in-mail-body – Mehul Kaklotar Apr 18 '13 at 17:16
  • but embedding causes spam filters to let your email wait until server can send it to the emailclient. the clue is to design an email so that it will be nice with AND without pictures. in most cases @andrewsi tip is the right one, so the client decides if pic or not. – Ol Sen Apr 18 '13 at 17:20
  • I guess another option would be to keep the image on your web server, and email out a link for people to click on? Though that then relies on people actually clicking. – andrewsi Apr 18 '13 at 17:25
  • 1
    This is the answer you're looking for: http://stackoverflow.com/a/7511063/1064767 – Sammitch Apr 18 '13 at 17:27

0 Answers0