I want a logo to appear in the emails sent, but they do not. The alt tag does show. I have looked at several sites on addEmbeddedImage and they all seem to follow the same pattern. Similarly in the Body tag. Do I have the two tags in the right place? Should one or both be in the **while
** statement along with $mail->send(); ?
I’ve tried using hard coding and string coding in the **addEmbeddedImage **tag but it doesn’t seem to matter. Please help with coding instead of forwarding me to some other discussion (BTW: that probably does not help most users).
$mail->AddEmbeddedImage("images/wncwasmall.jpg","logo","wncwasmall.jpg", "image/jpg" );
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = '<center><img alt="WNCWA Logo" src="cid:logo"></center>' . $message;
//Recipients
$mail->setFrom('[email protected]', 'WNCWA');
$mail->addReplyTo($replyto, $sender); //Reply to sender email
$mail->addAddress($from_email, $sender); //copy sent to sender
//----------------------------------------------------------------------------------------
// Connect to database -- connection is PDO
$sql= $conn->prepare("
SELECT fname, lname, email
FROM test
ORDER BY lname
");
$sql->execute();
while ($row = $sql->fetch()) {
$fname= $row['fname'];
$lname= $row['lname'];
$to= $row['email'];
$mail->addAddress($to, $subject);
$mail->send();
$mail->clearAddresses() ;
if($mail->send()) {}
else {echo "<div style='color:red;' >NOT sent - $fname $lname <br /></div> "; }
} // close while
} // close try
Phil R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.