I have a PHP Script to send an email using PHP mail.
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML("
<body>
<img src=`hulaminlogo.jpg`>
<br>
<h3>Load Number $loadnumber has been revoked by LOC.</h3><br>
</body>
");
$mail->Send();
The MsgHTML, works correctly however the <img src="hulaminlogo.jpg"> does not display. I have tried with ” as well. ” does not work as it ends the value MsgHTML.
How can I correctly format this syntax so the image displays correctly?
Nikola is correct that adding the full url to the img will alow the client to find and render the content – but by default most browsers won’t go fetch content unles explicitly told to do so. Simply adding the iage as an attachment won’t help – some MUAs might render it, most won’t. There’s 2 options for embedding the image within the email.
use mhtml to create a composite MIME attachment (works with MS clients but not much else, requires a lot of re-writing of code)
use data uris (requires a fairly up to date client but only needs minimal changes to your code)