Link to home
Start Free TrialLog in
Avatar of daisydoos
daisydoos

asked on

Sending PDF attachments using PHPMailer

Hi,

Am sending a PDF attachment using PHPMailer like this:

$mail->AddStringAttachment("files/pdf/name.pdf", "name.pdf");

The attachment is sent with the email, but when I try to open, or save it to my machine to open it, get a message saying "couldnt opne file because it's either not a supported file type or because the file has been damaged eg it was sent as an attachment and wasnt correctly encoded....

I tried adjust the method above like this:

$mail->AddStringAttachment("files/pdf/name.pdf", "name.pdf","base64", "application/pdf")

but this didnt work.

The original file (I am sending) does open ok.

Any thoughts greatly appreciated.

Daisy
 
ASKER CERTIFIED SOLUTION
Avatar of BrianGEFF719
BrianGEFF719
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daisydoos
daisydoos

ASKER

Hi Brian,

many thanks - worked a treat!

Cheers,

Daisy