我尝试了这个,但是我得到“错误:无法连接到服务器:无法找到套接字传输”ssl“ - 你是否忘记在配置PHP时启用它?”
$mail = new \PHPMailer(true);
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Username = "xctgrlx420@gmail.com";
$mail->Password = "wr^#@f9h@)(f";
$mail->AddAddress('contact@mywebsite.com', 'John Doe');
$mail->SetFrom('me@me.com', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->MsgHTML('Add some HTML here');
$mail->Send();
答案 0 :(得分:3)
一个简单的谷歌搜索显示了这个论坛 - http://forums.devshed.com/php-development-5/unable-to-find-the-socket-transport-ssl-667689.html
我想问题是你需要“OpenSSL extension”。