【发布时间】:2016-11-23 00:02:21
【问题描述】:
我正在尝试使用 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');
想法?
【问题讨论】:
-
你似乎没有告诉它发送...
-
我该怎么做?
-
您必须在
$mail对象上调用send()方法。见教程github.com/PHPMailer/PHPMailer/wiki/Tutorial