0

how do i use the phpmailer() class to send html emails with images embedded in it my code is shown below

<?php
require("class.phpmailer.php");

$msg = $_POST['msg'];
$subject = $_POST['subject'];


$mail = new PHPMailer();

$mail->IsSMTP();
$mail->Host = "smtp.branddesignexpress.com";
$mail->SMTPAuth = false;
$mail->Username = 'admin@example.com';
$mail->Password = '*****';

$mail->From="mailer@example.com";
$mail->FromName="My site's mailer";
$mail->Sender="mailer@example.com";
$mail->AddReplyTo("replies@example.com", "Replies for my site");

$mail->AddAddress("plasteezy@yahoo.com");
$mail->Subject = $subject;

$mail->IsHTML(true);
#$mail->AddAttachment('http://www.branddesignexpress.com/images/homepage_mainimage.jpg', 'homepage_mainimage.jpg');
$mail->AddEmbeddedImage('homepage_mainimage.jpg', 'logoimg', 'homepage_mainimage.jpg'); // attach file logo.jpg, and later link to it using identfier //logoimg
$mail->Body = $msg;
$mail->AltBody="This is text only alternative body.";

if(!$mail->Send())
{
   echo "Error sending: " . $mail->ErrorInfo;;
}
else
{
   echo "Letter is sent";
}
?>

Edited by plasteezy: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.