NYCPHP Meetup

NYPHP.org

[nycphp-talk] Multi part related emails

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


Mike,

Thanks very much! Just after I sent my message to the list I found a great
script for sending complex emails called PHPMailer
<http://phpmailer.sourceforge.net/>

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....

********************************************

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->From     = "sender at mydomain.com";
$mail->FromName = "Sample Name";
$mail->Host     = "smtp.mydomain.com";
$mail->Mailer   = "smtp";
$mail->IsHTML(true);
$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 example.com");
if(!$mail->Send()){
   echo "Message was not sent";
   echo "Mailer Error: " . $mail->ErrorInfo;
}else{
   echo "Message has been sent";
}
?>

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]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...
<snip>




More information about the talk mailing list