运行下面的 PHP 脚本时出现invalid address
错误。此帖子的 SMTP 凭据和收件人电子邮件已更改。它们在实际脚本上都是有效的。我不知道为什么收件人的电子邮件被拒绝。我正在尝试使用 SMTP 身份验证发送电子邮件,并且不需要 SMTP 安全性(SSL、TLS)。
任何帮助,将不胜感激。
include 'PHPMailer_5.2.2/class.phpmailer.php';
function SendConfirmation ($sName, $sEmail)
{
$mail = new PHPMailer ();
$mail->SMTPDebug = 2;
$mail->Host = "mail.exchange.telus.com";
$mail->IsSMTP ();
$mail->Username = "inbin@website.com";
$mail->Password = "password";
$mail->From = "inbin@website.com";
$mail->FromName = "Web Site";
$mail->AddAddress ($sEmail, $sName);
$mail->Subject = 'PHPMailer Test' . date ('Y-m-d H:i:s');
$mail->Body = "This is a test.";
if ($mail->Send ())
echo "\r\nMail sent.";
else
echo "\r\nMail not sent. " . $mail->ErrorInfo;
echo "\r\n";
}
/***[ Main ] **************************************************************************/
$sName = 'Johan Cyprich';
$sEmail = 'jcyprich@website.com';
$bSent = SendConfirmation ($sName, $sEmail);