Send email with PHPMailer - embed image in body
I'm trying to send HTML mail, with PHPMailer, with images. The body is loaded from a html file, that contains all the info.
When sending the mail, the image does not appear in the body, although I even send the image also as an attachment.
HTML <img> tag points to the same place as the place.
How can I make the html point to the attachment so the image can be loaded in the body.
Looking at the example that comes with PHPMailer I do not notice any difference, and in their case the image does appear.
I found the answer:
and on the <img> tag put src='cid:logo_2u'
According to PHPMailer Manual, full answer would be :
$mail->AddEmbeddedImage(filename, cid, name); //Example $mail->AddEmbeddedImage('my-photo.jpg', 'my-photo', 'my-photo.jpg ');
Use Case :
$mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png"); $mail->Body = 'Embedded Image: <img alt="PHPMailer" src="cid:my-attach"> Here is an image!';
If you want to display an image with a remote URL :