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');
phpmailer. php'); $email = new PHPMailer(); $email->From = '[email protected]'; $email->FromName = 'Your Name'; $email->Subject = $subject; $email->Body = $bodytext; while (list ($key, $val) = each ($address)) { $email->AddAddress($val); } if(!$ email->send()) { echo "Mailer Error: " .
PHPMailer can use a non-local mail server (SMTP) if you have authentication. Further advantages include: It can print various kinds of error messages in more than 40 languages when it fails to send an email. It has integrated SMTP protocol support and authentication over SSL and TLS.
But SPEWS can be worse than annoying: thanks to a security vulnerability in a popular web software component called PHPMailer, crooks could use your “contact us” form to take over your whole website. 24/7 threat hunting, detection, and response delivered by an expert team as a fully-managed service.
try this:
$mail->AddAttachment($_SERVER["DOCUMENT_ROOT"] . '/main-folder/files/a.doc', 'pricelist.doc');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With