I'm trying to email an embedded image in an email using PHPMailer, its not working, the image is not coming through. (I get a broken image)
Heres the image upload part (the image to be embedded)
<label for="Photo1">Image 1:</label>
<input type="file" id="Photo1" name="image1" size="28" />
and here's the phpMailer script to attach the image.
$Image1 = $_FILES['image1'];
$mail->AddEmbeddedImage($Image1, 'Image1', $Image1);
What am I doing wrong?
I think you have't done it properly. The only code above will not work.You need to have some token to pass from here. Like you should have a token ID in your HTML:
<img src="cid:1001" width="182" height="75">
Here note the token code "1001" with 'cid' where 1001 is the predefined code as far as i know which we cannot change. And if you want to embed more than one image in the email then you should have another token that means unique token id.
And now you should do the following to embed in PHP:
$mail->AddEmbeddedImage("/absolute/path/to/image.gif", 1001, 'imagename.gif');
Hope this will help you out there.
This topic is now closed. New replies are no longer allowed.