【发布时间】:2013-12-07 00:19:56
【问题描述】:
我无法使用 php mailer 类发送电子邮件。这是我得到的错误。
错误
Mailer 错误:以下发件人地址失败:admin@mobilebitzltd.com:调用 Mail() 时未连接。
这是我正在使用的代码。
$mail = new PHPMailer();
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.live.com'; // Specify main and backup server
$mail->Port = '465';
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'admin@mydoamin.com'; // SMTP username
$mail->Password = 'sdf'; // SMTP password
$mail->SetFrom($from, $from);
$mail->AddReplyTo($from, $from);
$mail->Subject = $subject;
$mail->MsgHTML($message);
$address = $to;
$mail->AddAddress($address, $customer_name);
if (!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
else
{
echo "Message sent!";
exit;
}
【问题讨论】:
-
请立即更改您的电子邮件密码。
-
邮件服务器的密码最好改一下。该通行证现在在所有编辑的历史记录中
-
您在 live.com 上更改了它,而不仅仅是在问题中?