gpt4 book ai didi

php - SMTP -> 错误 : Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (0)

转载 作者:搜寻专家 更新时间:2023-10-31 21:27:21 24 4
gpt4 key购买 nike

我需要发送邮件才能重设密码,但是每次我点击按钮重设密码时都会收到此错误。我将在下面发布我的代码:

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。任何帮助将非常感激。谢谢

最佳答案

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

程序:Ampps->PHP Tab->PHP extensions->enable openssl->Apply->Restart Ampps.

关于php - SMTP -> 错误 : Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34171336/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com