【发布时间】:2015-08-08 13:25:06
【问题描述】:
谁能帮我找出问题所在。我做了很多搜索,并且做了我发现没有成功的事情。
这是我的错误,phpmailer 是最新版本
2015-08-08 13:15:03 Connection: opening to ssl://smtp.mysite.com:465, timeout=300, options=array ( ) 2015-08-08 13:15:04 SMTP ERROR: Failed to connect to server: Connection refused (111) 2015-08-08 13:15:04 SMTP connect() failed.
这是我的代码。
$m = new PHPMailer;
//Setup
$m->isSMTP();
$m->SMTPAuth = true;
//authentication
$m->Host = 'smtp.gmail.com';
$m->Username = 'info@example.com';
$m->Password = 'password';
$m->SMTPSecure = 'ssl';
$m->Port = 465;
$m->SMTPDebug = 3;
//from
$m->AddReplyTo($email, $name);
$m->SetFrom('info@example.com', $name);
//to
$m->addAddress('ari@example.com','guy johnson');
$m->addCC('joe@example.com','Joe johnson');
//message
$m->Subject = $subject;
$m->Body = $message;
if(!$m->Send()) {
echo"<script type=\"text/javascript\">".
"alert('A Error Occured, Please Try Again.');".
"</script>";
} else {
echo"<script type=\"text/javascript\">".
"alert('Message Sent. Please allow atleast 24-hours for a response');".
"window.location='http://example.com';".
"</script>";
}
提前致谢!
【问题讨论】:
-
你确定端口正确吗?
-
@ajon 这就是它所说的放在我看过的任何地方。
标签: php email google-apps