【发布时间】:2014-01-21 05:58:16
【问题描述】:
这是我的php 脚本:
<?php
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
include("../class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 2; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "x@gmail.com";
$mail->Password = "1234";
$mail->From = "y@gmail.com";
$mail->Subject = "Need Invitation";
$mail->Body = "invite me!";
$mail->AddAddress("x@gmail.com");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>
执行此脚本后,我收到以下错误:
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (1)
我还启用了ssl:
有很多问题与此非常相似,但没有从那里得到任何帮助。
【问题讨论】:
标签: php ssl smtp openssl phpmailer