我正在尝试使用PHPMailer Master发送附带.PDF的电子邮件。
我没有收到任何电子邮件,看到没有错误,也无法理解发生了什么。
这是我的代码:
$url = ''. $_SERVER['DOCUMENT_ROOT'] .'/free-quote/';
$mail = new PHPMailer;
$mail->setFrom('removed@email.com', 'Company Name');
$mail->addAddress(''. $email2 .'', ''. $full_name .'');
$mail->Subject = 'Website Quotation ('. $quotation_ref .')';
$mail->addStringAttachment(file_get_contents($url), ''. $quotation_ref .'.pdf');
$mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';
我还包含了所需的文件:
require('PHPMailer-master/class.phpmailer.php');
想法?
答案 0 :(得分:1)
来自PHPMailer文档:
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}