douyi6755 2012-02-28 18:51
浏览 49
已采纳

你能用PHPmailer从localhost发送电子邮件吗?

I tried this, but I get "ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured 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();
  • 写回答

1条回答 默认 最新

  • dswe30290 2012-02-28 18:54
    关注

    A simple google search revealed this forum - http://forums.devshed.com/php-development-5/unable-to-find-the-socket-transport-ssl-667689.html

    And I guess the problem is that you need "OpenSSL extension".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有没有能解决微信公众号,只能实时拍照,没有选择相册上传功能,我不懂任何技术,,有没有给我发个软件就能搞定的方法
  • ¥15 Pythontxt文本可视化
  • ¥15 如何基于Ryu环境下使用scapy包进行数据包构造
  • ¥15 springboot国际化
  • ¥15 搭建QEMU环境运行OP-TEE出现错误
  • ¥15 Minifilter文件保护
  • ¥15 有限元软件终止时间超过设定值
  • ¥15 onvif框架引用一直报错
  • ¥50 C#和C++混合编程,使用CLR托管,报错System.Runtime.InteropServices.SEHException
  • ¥30 .NET使用sqlite发布后报错