php - AddEmbeddedImage() function embadding inline images as well as attaching same image as attachement -
i have added following parameters phpmailer object. though have embedded images inline purpose using addembeddedimage() function, working expected, additionally attaching same images attachment email & displaying @ bottom.
$msg = `<table><tr><td colspan="2"><img src="cid:header_jpg" alt="www.example.in" width="770" height="4" border="0" /></td></tr></table>`; $mail = new phpmailer(true); //new instance, exceptions enabled $mail->issmtp(); // tell class use smtp $mail->smtpauth = false; // enable smtp authentication $mail->port = 25; // set smtp server port $mail->host = 'localhost'; // smtp server $mail->username = ""; // smtp server username $mail->password = ""; // smtp server password $mail->addreplyto($sender, $sender_name); $mail->from = $sender; $mail->fromname = $sender_name; $mail->addaddress($receiver); $mail->subject = $subject; //$mail->altbody = "to view message, please use html compatible email viewer!"; // optional, comment out , test $mail->wordwrap = 80; // set word wrap $mail->msghtml($msg); $mail->ishtml(true); // send html $mail->addembeddedimage('./images/header.jpg', 'header_jpg'); $mail->addembeddedimage('./images/logo.jpg', 'logo_jpg'); $mail->addembeddedimage('./images/alert_icon.png', 'alert_icon_png', 'alert_icon.png'); $mail->send();
please suggest possible...
i having same issue web email embedded images. tried different approaches , got these results:
sending html email yahoo:
$mail->addembeddedimage("some_picture.png", "my-attach", "some_picture.png", "base64", "image/png");
or
$mail->addembeddedimage("some_picture.png", "my-attach", "some_picture.png", "base64", "application/octet-stream");
or
$mail->addembeddedimage("some_picture.png", "my-attach", "some_picture.png");
same results; yahoo showed embedded image correctly still attached too!
with hotmail, correctly embedded image , no attachments added.
finally, fount phpmailer has ability automatically embed images html email. have put full path in file system, when writing html email. i ended disregarding addembeddedimage , link source of image directly location on website. worked correctly in both hotmail , yahoo , no attachment added in yahoo.
<img src="http://full_path-to-image" alt="this image" />
needless say, embedded images in emails may not show unless user clicks "show images" button; depends on privacy & security settings.
i hope helps!
Comments
Post a Comment