目前我正在尝试使用 PHPmailer 发送电子邮件。这是下面的代码
<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer(); // ---------- adjust these lines --------------------------- ------------
$mail->Username = "(username@hotmail.com)"; // your hotmail user name
$mail->Password = "password";
$mail->AddAddress"(username@hotmail.com)"; // recipients email
$mail->FromName = "test"; // readable name
$mail->Subject = "Subject title";
$mail->Body = "Here is the message you want to send to your friend.";
//-----------------------------------------------------------------------
$mail->Host = "smtp.live.com"; // GMail
$mail->Port = 25; $mail->IsSMTP(); // use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->From = $mail->Username;
if(!$mail->Send())
echo "Mailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
?>
我已经使用 PHPMailer 尝试了 SSL,端口 587 用于 smtp.live.com,为什么它不起作用?
错误是“SMTP 错误:无法连接到 SMTP 主机。邮件程序错误:SMTP 错误:无法连接到 SMTP 主机。”
我无法远程登录 smtp.live.com 25,587。smtp.gmail.com 等等等等。我该怎么办?:(