【问题标题】:PHPMailer Master not sending EmailPHPMailer Master不发送电子邮件
【发布时间】: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');

想法?

【问题讨论】:

标签: php phpmailer


【解决方案1】:

来自 PHPMailer 文档:

    if(!$mail->send()) {
      echo 'Message could not be sent.';
      echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
      echo 'Message has been sent';
    }

https://github.com/PHPMailer/PHPMailer

【讨论】:

    猜你喜欢
    • 2013-10-05
    • 1970-01-01
    • 1970-01-01
    • 2021-10-24
    • 1970-01-01
    • 2014-10-19
    • 2021-01-03
    • 2014-07-04
    • 2019-01-19
    相关资源
    最近更新 更多