Alex Rivera | Logout

how to add file attachment in PHPMailer?

Asked 2012-02-02T12:13:54.910
11

I am using PHPMailer for mailing facility, I want add file with each mail from my server.

following is folder structure on my server.

-public-html
  - main-folder
    - files
       - a.doc
       - b.docx
    - mailer
       - mailer.php

i have tried the following line in my mailer.php file but it is not working

$mail->AddAttachment('main-folder/files/a.doc', 'pricelist.doc'); 
Edit
Report

1 Answer

0

Your path was wrong, for the record. you needed to be giving the string '../files/a.doc' instead, based on the file layout you gave in the question. IT was not PHPMailer requiring a full absolute path to the file.

answered 2012-02-14T05:53:00.457

Your Answer