gpt4 book ai didi

缺少 : openssl 的 PHPMailer 扩展

转载 作者:太空宇宙 更新时间:2023-11-03 17:08:11 26 4
gpt4 key购买 nike

基于 PHPMailer 提供的示例,我有这个脚本:

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
if($_POST){
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$patrimonio = $_POST['patrimonio'];
$serial = $_POST['serial'];
$unidade=$_POST['unidade'];
$endereco=$_POST['endereco'];
$setor=$_POST['setor'];
$telefone=$_POST['telefone'];
$procedencia=$_POST['procedencia'];
$equipamento=$_POST['equipamento'];
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = gethostbyname("smtp.gmail.com");
$mail->Port = 587;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "myemail@gmail.com";
$mail->Password = "mypass";
$mail->setFrom("myemail@gmail.com", 'Gerador de OS');
$mail->addAddress($email, $name);
$mail->AddBCC('HelpDesk@gmail.com', $name);
$mail->Subject = "Abertura de OS";
$mail->Body=$message;
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "true";
}
}

即使这与原始示例完全相同,我也无法使其正常工作。

我得到的错误是:

Extension missing: openssl
Mailer Error: Extension missing: openssl

但是服务器说下面的命令一切正常:

php -i | grep -i openssl

结果是:

openssl

OpenSSL support => enabled

OpenSSL Library Version => OpenSSL 1.0.1 14 Mar 2012

OpenSSL Header Version => OpenSSL 1.0.1 14 Mar 2012 Native

OpenSSL support => enabled

此服务器中有 joomla,我可以确认 OpenSSL 正在运行。

Joomla informations

More joom informations

最佳答案

在 PHP 7 上,取消注释 php.ini 文件中第 921 行附近的 extension=php_openssl.dll。还要检查 extension=php_openssl.dll 是否取消注释1945 年。

关于缺少 : openssl 的 PHPMailer 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46613606/

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