相关疑难解决方法(0)

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

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

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

这是我的代码:

$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); …
Run Code Online (Sandbox Code Playgroud)

php

13
推荐指数
1
解决办法
4万
查看次数

如何修复SSL证书验证失败

我在本地使用PHPMailer以及Apache和PHP。当我测试我的SSL配置和我的证书时,我得到了

default_cert_file = C:\Program Files\Common Files\SSL/cert.pem
default_cert_file_env = SSL_CERT_FILE
default_cert_dir = C:\Program Files\Common Files\SSL/certs
default_cert_dir_env = SSL_CERT_DIR
default_private_dir = C:\Program Files\Common Files\SSL/private
default_default_cert_area = C:\Program Files\Common Files\SSL
ini_cafile = 
ini_capath = 
Run Code Online (Sandbox Code Playgroud)

然后,我做

 var_dump(fsockopen("smtp.gmail.com", 465, $errno, $errstr, 3.0));
 var_dump($errno);
 var_dump($errstr);
Run Code Online (Sandbox Code Playgroud)

我得到

fsockopen resource(2) of type (stream) int(0) string(0) "" 
Run Code Online (Sandbox Code Playgroud)

在我的php.ini我curl.cainfo = C:/php/cacert.pem的curl一部分,它的工作原理。

但是当我尝试使用PHPMailer从本地主机发送邮件时,我不断

SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 
Failed to enable crypto
unable to connect to ssl://smtp.gmail.com:465 (Unknown …
Run Code Online (Sandbox Code Playgroud)

php ssl ssl-certificate phpmailer php-openssl

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

php ×2

php-openssl ×1

phpmailer ×1

ssl ×1

ssl-certificate ×1