PHPMailer偶尔会失败

时间:2014-01-23 23:03:45

标签: php phpmailer

我使用PHPMailer发送电子邮件,但有时会失败。

$email = new \PHPMailer();
$email->isSMTP();
$email->Host = 'smtp.gmail.com';
$email->SMTPAuth = true;
$email->Username = '...';
$email->Password = '...';
$email->SMTPSecure = 'tls';
$email->Port = 25;
$email->From = '...';
$email->FromName = '...';
$email->Subject = '...';
$email->addAddress( '' );
$email->Body = '...';
$email->isHTML( true );

if ( !$email->send() ) {
     echo $email->ErrorInfo;
}

我收到The following From address failed: ... : Called Mail() without being connected错误。

注意,有时它会成功,有时则不会。

0 个答案:

没有答案