嗨,我正在尝试使用PHPMailer,它不工作,给我带来了错误
连接:打开ssl://smtp.gmail.com:465,timeout=300,options=array ()
这是我的密码
require_once('mailFiles/PHPMailerAutoload.php');
echo (extension_loaded('openssl')?'SSL loaded':'SSL not loaded')."<br/>";
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 4;
$mail->Debugoutput = 'html';
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
// $mail->SMTPSecure = 'tls';
$mail->Host = 'smtp.gmail.com';
// $mail->Host = gethostbyname('smtp.gmail.com');
// $mail->Host = 'tls://smtp.gmail.com:587';
// $mail->Port = 587;
$mail->Port = 465;
$mail->Username = "xs4arabiabahrain@gmail.com";
$mail->Password = "mailpass";
$mail->setFrom('mail@gmail.com', 'Firstz Last');
$mail->addAddress('myemail@gmail.com', 'MAAGE-EMAIL User');
$mail->IsHTML(true);
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML('Hi test 123');
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
$result = $mail->send();
if (!$result) {
echo ("Mailer Error: ");
echo ($mail->ErrorInfo);
} else {
echo ("Message sent!");
}累了还没工作。
发布于 2016-10-15 06:54:05
问题是我的防病毒,我使用的是McAfee,你需要改变它的设置,请跟随这个链接来改变这些设置,我希望它也能帮助其他人。
https://stackoverflow.com/questions/39568267
复制相似问题