我曾经phpgmailer
发送电子邮件,它工作顺利。今天我测试了我的项目,但它现在无法正常工作。
<?php
require_once('class.phpgmailer.php');
$mail = new PHPGMailer();
$mail->Username = 'username@gmail.com';
$mail->Password = '********';
$mail->From = 'username@gmail.com';
$mail->FromName = "<blah>";
$mail->Subject = 'something';
$mail->AddAddress('xyz@gmail.com');
$mail->Body = "Hello Sir"."\n"."
Your Password is : ."."";
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Send();
if(!$mail->Send())
{
echo 'Message could not be sent.' ;
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';