gpt4 book ai didi

php - 解决错误 "PHPMailer Error: Extension missing: openssl"

转载 作者:行者123 更新时间:2023-12-03 19:04:27 24 4
gpt4 key购买 nike

我已经删除了;对于 php.ini 中的 openssl 以及 apache 文件夹。我仍然收到错误“PHPMailer Error: Extension missing: openssl” 以下是php代码,我也设置了phpmailerautoload。

PHP 代码:

<?php
require "PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// or try these settings (worked on XAMPP and WAMP):
/*$mail->Port = 587;
$mail->SMTPSecure = 'tls';*/


$mail->Username = "vignesh*******45@gmail.com";
$mail->Password = "********";

$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "vignesh*******45@gmail.com";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******45@gmail.com","User 1");

//$mail->addCC("user.3@ymail.com","User 3");
//$mail->addBCC("user.4@in.com","User 4");

$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
?>

请帮助我解决错误。我也在 wampserver 中启用了 openssl。

最佳答案

IIS 上的 PHP,

1) 打开(php安装目录)php.ini

2) 取消注释(~ php.ini 中的第 910 行)扩展=php_openssl.dll

3) 重启 IIS

关于php - 解决错误 "PHPMailer Error: Extension missing: openssl",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30284409/

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