[nycphp-talk] Multi part related emails

Wellington Fan wfan at
Fri Aug 1 14:23:06 EDT 2003


Thanks very much! Just after I sent my message to the list I found a great
script for sending complex emails called PHPMailer

Below is the code that I used to send an HTML email with an embedded image.
Note the src value of the image -- it uses a "protocol" called "cid:" which I
must investigate. Seems like that must refer to another "part" in the
multipart message....


$mail = new PHPMailer();
$mail->From     = "sender at";
$mail->FromName = "Sample Name";
$mail->Host     = "";
$mail->Mailer   = "smtp";
$mail->AddEmbeddedImage("foo.gif", "my-attach", "foo.gif");
$mail->Body = 'Embedded Image: <img alt="PHPMailer" src="cid:my-attach"> Here
is an image!';

$mail->AddAddress("recipient at");
   echo "Message was not sent";
   echo "Mailer Error: " . $mail->ErrorInfo;
   echo "Message has been sent";

-----Original Message-----
From: talk-bounces at
[mailto:talk-bounces at]On Behalf Of DeWitt, Michael
Sent: Friday, August 01, 2003 1:40 PM
To: 'NYPHP Talk'
Subject: RE: [nycphp-talk] Multi part related emails

I had this same need and found this bit of code on the web which I modified
a bit to suit my need...

More information about the talk mailing list