警告:stream_socket_enable_crypto():该流在第197行的C:\ xampp \ htdocs \ 12work \ class.smtp.php中不支持SSL/加密 [英] Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class.smtp.php on line 197

查看:146
本文介绍了警告:stream_socket_enable_crypto():该流在第197行的C:\ xampp \ htdocs \ 12work \ class.smtp.php中不支持SSL/加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using XAMPP and when trying to send email through localhost I get the following warning:

警告: stream_socket_enable_crypto():此流不支持在线C:\xampp\htdocs\12work\class.smtp.php中的SSL/加密 197

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 模块.这是操作方法:

Alright, we need to enable Open SSL module. Here is how to do it:

  1. 找到并打开您的php.ini文件
  2. 搜索该行:;extension=php_openssl.dll
  3. 通过删除 ; 字符来启用模块.
  4. 保存文件并重新启动Apache.
  1. Locate and open your php.ini file
  2. Search for the line: ;extension=php_openssl.dll
  3. Enable the module by removing ; char.
  4. Save the file and restart Apache.


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


Hint: If you are not familiar with php.ini file, it is recommended to create a backup before modification. Ini is a configuration file and misconfigured or corrupted ini can result in that web server will not start.

如果您使用的是WAMP之类的LAMP堆栈,则应该可以通过图形界面启用模块.

If you are using LAMP stacks such as wamp, it should be possible to enable modules via graphic interface.

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

More about php.ini: https://secure.php.net/manual/en/configuration.file.php

这篇关于警告:stream_socket_enable_crypto():该流在第197行的C:\ xampp \ htdocs \ 12work \ class.smtp.php中不支持SSL/加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆