1
任何人都可以幫助我找出問題在這裏。我做了很多搜索,並且完成了我發現沒有成功的事情。使用phpmailer與谷歌應用
這裏是我的錯誤,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 = '[email protected]';
$m->Password = 'password';
$m->SMTPSecure = 'ssl';
$m->Port = 465;
$m->SMTPDebug = 3;
//from
$m->AddReplyTo($email, $name);
$m->SetFrom('[email protected]', $name);
//to
$m->addAddress('[email protected]','guy johnson');
$m->addCC('[email protected]','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
@ajon多數民衆贊成它說什麼把我到處看。 – flo