Jump to content

PHPmailer attachment and images in body together - HELP please!


johnx

Recommended Posts

Hello, I have big problem here. I need to create HTML email with images displayed in the body of the mail and I need to attach PDF document as normal file attachment.

This is easy by using phpMailers functions AddEmbeddedImage and addAttachment, but some emails clients do not show pdf (file) attachment if I use AddEmbeddedImage before/after..

 

Images in the body must works in offline too (I can not use external links to show images in the email body)...

 

Can somebody help? There is example of source code:

 

<?php

$mail = new phpmailer();

 

 

 

$mail->From = 'mail.mail@mailer.com';

$mail->Subject  = 'PDF document';

$mail->IsHTML(true);

 

$mail->AddAddress('someone@mail.com');

 

$mail->AddAttachment('document.pdf','document.pdf',"base64","application/pdf");

$mail->AddEmbeddedImage("logo.gif","weblogo","weblogo.gif","base64","image/gif");

 

$mail->Body = "<table><tr><td>Ahoj blabal</td><td><img src='cid:weblogo'></td></tr></table>";

$mail->Send();

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.