SMTP->;错误:无法连接到服务器:找不到套接字传输;ssl";-配置PHP时是否忘记启用它?(0)

SMTP->;错误:无法连接到服务器:找不到套接字传输;ssl";-配置PHP时是否忘记启用它?(0),php,sockets,email,ssl,smtp,Php,Sockets,Email,Ssl,Smtp,我需要发送邮件以重置密码,但是每次单击按钮重置密码时都会出现此错误。我将在下面发布我的代码: require_once('mailer/class.phpmailer.php'); $uri = 'http://'. $_SERVER['HTTP_HOST'] ; $from_name = 'test'; $from = 'test@gmail.com';

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

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!";
                    }
require_once('mailer/class.phpmailer.php');
$uri='http://'$_服务器['HTTP_主机'];
$from_name='test';
$fromtest@gmail.com';
$to=$email;
$to_name='test';
$message='单击给定链接重置密码

'; $message.=“问候
”; $message.='test'; $mail=new PHPMailer(); $mail->SMTPDebug=2;//启用SMTP调试信息(用于测试) $mail->IsSMTP(); $mail->Port=587;//或587//将邮件程序设置为使用SMTP $mail->Host=”ssl://smtp.mandrillapp.com"; // 指定主服务器和备份服务器 $mail->SMTPAuth=true;//启用SMTP身份验证 $mail->Username='***************';//SMTP用户名 $mail->Password='******************';//SMTP密码//SMTP帐户密码 $mail->SetFrom($from,$from_name); $mail->AddReplyTo($from,$from_name); $mail->Subject='passwordchange'; $mail->MsgHTML($message); $mail->AddAddress($to,$to_name); 如果(!$mail->Send()) { 回声:“对不起!”; }

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

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

程序: AMPS->PHP选项卡->PHP扩展->启用openssl->应用->重新启动AMPS