<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
// ---------- adjust these lines ---------------------------------------
$mail->Username = "mymail@gmail.com"; // your GMail user name
$mail->Password = "xxxxxxxxxx";
$mail->AddAddress("yourmail@yahoo.com"); // recipients email
$mail->FromName = "abc"; // readable name
$mail->Subject = "Sample Email";
$mail->Body = "Here is the message you want to send to your friend.";
//-----------------------------------------------------------------------
$mail->Host = "ssl://smtp.gmail.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";
?>
邮件程序错误:以下发件人地址失败:mymail@gmail.com:调用Mail()而未连接。
我该如何解决?