AvailableSomething Went WrongSMTP connect((失败。https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.我的密码和电子邮件是正确的,我的SSL是打开的。这是我的代码:
<?php
echo !extension_loaded('openssl')?"Not Available":"Available";
$news = $_REQUEST['news'];
require 'phpmailer/PHPMailerAutoload.php';
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$mail= new PHPMailer;
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port=587;
$mail->isSMTP();
$mail->SMTPAuth=true;
$mail->SMTPSecure='ssl';
$mail->Username='omer.subohh@gmail.com';
$mail->Password='mypassword';
$mail->setFrom('omer.subohh@gmail.com', 'FixHub');
$mail->addAddress('omer.subohh@gmail.com', 'FixHub'); //Add a recipient
$mail->isHTML(true);
$mail->Subject = 'New Subscriber For FixHub NewsLetters';
$mail->Body = '<h2>'.$news.'</h2>';
if(!$mail->send())
{
echo "Something Went Wrong";
echo $mail->ErrorInfo;
}
else{
header("Location: index.php");
}
?>
您应该更改ssl://smtp.gmail.com至smtp.gmail.com
并将SMTPSecure更改为";tls";
主机名不应包括加密类型