/ / PHP Mailer stellt keine Verbindung zum Server her - PHP, Google Mail, Phpmailer

PHP-Mailer schlägt fehl, mit Server zu verbinden - php, gmail, phpmailer

Hier ist mein PHP-Code:

require_once("class.phpmailer.php");

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->CharSet="utf-8";
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "clubbedinapp@gmail.com";
$mail->Password = "pw";
$mail->SMTPAuth = true;

$mail->From = "clubbedinapp@gmail.com";
$mail->FromName = "Clubbed In";
$mail->AddAddress("nishil.shah17@gmail.com");
$mail->AddReplyTo("clubbedinapp@gmail.com", "Information");

$mail->IsHTML(true);
$mail->Subject    = "PHPMailer Test Subject via Sendmail, basic";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
$mail->Body    = "Hello";

if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}

Ich habe ein Google Mail PHPMailer-Tutorial befolgt. Ich habe keine Ahnung, was falsch ist. Kann jemand bitte helfen?

Antworten:

2 für die Antwort № 1

Haben Sie openssl in Ihrer php.ini aktiviert?

Gehe zu PHP.ini und finde eine Zeile namens

;extension=php_openssl.dll

und entfernen Sie das Semikolon am Anfang der Zeile.

Stoppen Sie den Apache-Server und alle Server, starten Sie sie erneut, und versuche es noch einmal.