【问题标题】:SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (0)SMTP -> 错误:无法连接到服务器:无法找到套接字传输“ssl” - 您在配置 PHP 时是否忘记启用它? (0)
【发布时间】:2016-03-14 06:50:21
【问题描述】:

我需要发送邮件来重设密码,但是每次单击按钮重设密码时都会出现此错误。我将在下面发布我的代码:

require_once('mailer/class.phpmailer.php');

                    $uri = 'http://'. $_SERVER['HTTP_HOST'] ;
                    $from_name = 'test';
                    $from = 'test@gmail.com';
                    $to = $email;
                    $to_name = 'test';
                    $message = 'Click on the given link to reset your password <a href="'.$uri.'/reset.php?token='.$token.'">Reset Password</a></p>';

                    $message .= 'Regards<br>';
                    $message .= 'test';

                    $mail = new PHPMailer();
                    $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                    $mail->IsSMTP();    
                    $mail->Port = 587; // or 587                         // set mailer to use SMTP
                    $mail->Host = "ssl://smtp.mandrillapp.com";  // specify main and backup server
                    $mail->SMTPAuth = true;     // turn on SMTP authentication
                    $mail->Username = '****************';  // SMTP username
                    $mail->Password = '****************'; // SMTP password      // SMTP account password

                    $mail->SetFrom($from,$from_name );
                    $mail->AddReplyTo($from,$from_name );
                    $mail->Subject  = 'Password Change';
                    $mail->MsgHTML($message);
                    $mail->AddAddress($to,$to_name);

                    if(!$mail->Send())
                    {
                        echo "sorry!";
                    }

我看到一些帖子说我需要更改/取消注释用于 open_ssl.dll 的扩展。我在 php.ini 文件或 php-5.3.ini 中的任何地方都找不到该行。我在 Ubuntu 14.04 上使用 Ampps。任何帮助将非常感激。谢谢

【问题讨论】:

    标签: php sockets email ssl smtp


    【解决方案1】:

    好的,我解决了,在 Ampps App 本身中,有一个 PHP 选项卡,去那里,点击 PHP 扩展并找到 openssl 扩展。检查它,点击应用。重新启动 Ampps,瞧! SMTP 服务器已启动并正在运行。

    程序: Ampps->PHP选项卡->PHP扩展->启用openssl->应用->重启Ampps。

    【讨论】:

      猜你喜欢
      • 2014-03-24
      • 2011-01-13
      • 2015-12-21
      • 2017-08-16
      • 1970-01-01
      • 2018-05-24
      • 2018-11-29
      • 1970-01-01
      相关资源
      最近更新 更多