gpt4 book ai didi

php - 第 197 行警告 : stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class. smtp.php

转载 作者:IT王子 更新时间:2023-10-29 00:07:26 27 4
gpt4 key购买 nike

我正在使用 XAMPP,当尝试通过 localhost 发送电子邮件时,我收到以下警告:

Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class.smtp.php on line 197

这是我的代码:

$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP

$mail->Host = "smtp.gmail.com"; // specify main and backup server

$mail->SMTPAuth = true;
$mail->Port = 25;

$mail->SMTPSecure = "tls";

$mail->SMTPAuth = true; // turn on SMTP authentication

$mail->Username = "sheikh.abm@gmail.com"; // SMTP username

$mail->Password = "mypassword"; // SMTP password

$mail->From = "sheikh.abm@gmail.com"; //do NOT fake header.

$mail->FromName = "MailMan";

$mail->AddAddress("sheikh.abm@gmail.com"); // Email on which you want to send mail

$mail->IsHTML(true);

$mail->Subject = "Just a Test";

$mail->Body = "Hello. I am testing <b>PHP Mailer.</b>";

if(!$mail->Send())

{

echo $mail->ErrorInfo;

}else{

echo "email was sent";

}

最佳答案

好的,我们需要启用Open SSL 模块。方法如下:

  1. 找到并打开您的 php.ini 文件
  2. 搜索行:;extension=php_openssl.dll
  3. 通过删除 ; 字符启用模块。
  4. 保存文件并重新启动 Apache。

提示:如果您不熟悉php.ini 文件,建议在修改前创建一个备份。 ini 是一个配置文件,配置错误或损坏的 ini 会导致 web 服务器无法启动。

如果您使用的是 wamp 等 LAMP 堆栈,应该可以通过图形界面启用模块。

关于 php.ini 的更多信息: https://secure.php.net/manual/en/configuration.file.php

关于php - 第 197 行警告 : stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class. smtp.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14978459/

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