Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29767

AddEmbeddedImage() function embadding inline images as well as attaching same image as attachement

$
0
0

I have added following parameters to PHPMailer object. Though I have embedded images for inline purpose using AddEmbeddedImage() function, it is working as expected, but additionally attaching same images as attachment to email & displaying at 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, with exceptions enabled
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth   = false;        // enable SMTP authentication
$mail->Port       = 25;           // set the 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 the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap   = 80; // set word wrap

$mail->MsgHTML($msg);

$mail->IsHTML(true); // send as 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 something as early as possible...


Viewing all articles
Browse latest Browse all 29767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>