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 魔霸ROG7 pro,win11.息屏后会显示黑屏,如图,如何解决?(关键词-重新启动)
  • ¥15 有没有人知道这是哪里出了问题啊?要怎么改呀?
  • ¥200 C++表格文件处理-悬赏
  • ¥15 Windows Server2016本地登录失败
  • ¥15 复合卡卡号轨道写入芯片卡
  • ¥20 基于MATLAB的TDOA
  • ¥15 为啥输入字体突然变了
  • ¥20 已知坐标,换成MATLAB可以用的数据
  • ¥15 这个python五子棋代码的每一句意思是什么啊
  • ¥15 求一段隐藏代码,隐藏一些内容