Send Embedded Image to mail - PHP Views : 471
Tagged in : PHP
0 0
Send mail
Normally the image not shown in mail, instead of this we have to click 'show image' link.
But the following code will display the image without clicking 'show image'.


<?php
$eid=$_GET['mail'];
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsMail();
$mail->From = "example@mail.com";
$mail->AddAddress("$eid");
$mail->Subject = "sending image to mail";
$mail->IsHTML(true);
$mail->AddEmbeddedImage("image_03.gif","mailimage","image_03.gif","base64","image/gif");
$mail->Body="<table style='border: thin solid #4682B4; border-collapse: collapse;' align='center' width=100%> <tr><td><img src='cid:mailimage'></td></tr></table>";
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
echo "Message sent";
?>

By raveendran, On - 2009-11-07



    Login to add Comments .