SparkPost电子邮件不起作用

时间:2018-08-03 06:22:24

标签: php smtp phpmailer sparkpost

我在我的网站http://hlwmm.org中使用了sparkpost电子邮件。我已经将PHP Phpmailer库与Sparkpost SMTP一起使用了。它工作正常,但现在不工作。以下是我的代码

// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

$mail = new PHPMailer;
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.sparkpostmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'SMTP_Injection';
$mail->Password = 'XXXXXXXXXXXXXXXXXXXXXXXX';

$mail->setFrom('inquiry@hlwmm.org');

$mail->addAddress($to);
$mail->Subject = "Test Subject";
$mail->Body = "Test Sparkpost Email";

$mail->send();

我遇到错误

2018-08-03 05:55:31 SERVER -> CLIENT: 220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.39.65390 r(Core:4.2.39.50) Fri, 03 Aug 2018 05:55:31 +0000
2018-08-03 05:55:31 CLIENT -> SERVER: EHLO hlwmm.org
2018-08-03 05:55:31 SERVER -> CLIENT: 250-b.mta1vsmtp.cc.aws-usw2b.prd.sparkpost says EHLO to 162.214.3.26:35530250-ENHANCEDSTATUSCODES250-8BITMIME250-PIPELINING250-AUTH=LOGIN PLAIN250-AUTH LOGIN PLAIN250 STARTTLS
2018-08-03 05:55:31 CLIENT -> SERVER: STARTTLS
2018-08-03 05:55:31 SERVER -> CLIENT: 220 2.0.0 continue
SMTP Error: Could not connect to SMTP host.
2018-08-03 05:55:31 SMTP NOTICE: EOF caught while checking if connected
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Error

谢谢

0 个答案:

没有答案