简体   繁体   English

phpmailer截至美国东部标准时间下午2点之前的12/4

[英]phpmailer was working as of 12/4 prior to 2pm est

ok so im at 30 hours non stop trying to figure out this code as to why it stopped working out of nowhere and its really starting to piss me off now. 好的,即时消息在30小时后不间断地尝试找出此代码,以了解为什么它突然冒出来停止工作,并且现在真的让我生气。

it is a production server and was working just fine until title time. 它是生产服务器,直到标题时间都可以正常工作。

here is my testemail.php that did work prior to this date-time. 这是我的testemail.php,它在此日期时间之前有效。

<?php
require 'include\smtp\class.phpmailer.php';
require 'include\smtp\class.smtp.php';
set_time_limit(3600);
date_default_timezone_set('Etc/UTC');
$mail = new PHPMailer();  // create a new object

$mail->Timeout = 3600;
$mail->IsHTML();
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 4;  // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true;  // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465; 
$mail->Username = "email";
$mail->Password = "pass";        
$mail->SetFrom( "email",  "Do Not Reply");
$mail->Subject = "test";
//$mail->AddAttachment($dir.str_replace("/", "\\", $row2["eventpdf"]));
$mail->Body = "testing";
$mail->AddAddress("email");

if(!$mail->Send()) {
    $error = 'Mail error: '.$mail->ErrorInfo; 
    } else {
    $error = 'Message sent!';

    }
    ?>

UPDATE: 更新:

i updated my class.phpmailer.php and class.smtp.php to vs 5.2.26 from github and applied the work around of 我从github将我的class.phpmailer.php和class.smtp.php更新为vs 5.2.26,并应用了

$mail->SMTPOptions = array(
'ssl' => array(
    'verify_peer' => true,
    'verify_peer_name' => false,
    'allow_self_signed' => true
)
);

right before the if(!$mail line. this is a temp solution while i figure out why the ssl cert is pulling it from the wrong location and where to set the proper one. its pulling stuff from /usr/local/ssl however this is a windows machine and thinks its a linux one. also not using any prepackaged amp system. im using all separate installs. apache/php/mysql all alone. 就在if(!$ mail行之前。这是一个临时解决方案,而我想知道为什么ssl证书会从错误的位置拉出它,以及在哪里设置正确的位置。它从/ usr / local / ssl那里拉出东西是Windows机器,认为它是Linux机器,也没有使用任何预包装的amp系统,im仅使用所有单独的安装,apache / php / mysql都单独使用。

fyi: 费:

the verify_peer once set to true is what causes the issue. 设置为true的verify_peer是导致问题的原因。 you can change anything else to true/false and it will send. 您可以将其他任何内容更改为true / false,然后它将发送。 once you change verify_peer to true it stops. 一旦将verify_peer更改为true,它就会停止。

Fixed correctly. 正确修复。 Under PHPMailer troubleshooting download a new cacert.pem and inside your php.ini you need to scroll to the bottom(at least mine was at bottom) or search for cafile or capath and add the path and file. 在“ PHPMailer故障排除”下,下载一个新的cacert.pem,并在php.ini内滚动至底部(至少我的底部),或搜索cafile或capath并添加路径和文件。 File needs to be the complete path to it because it gave me an error of it wasn't. 文件必须是它的完整路径,因为它给了我一个错误,不是。 Like c:\\certs\\cacert.pem then restart your Apache server and either change verify_peer to true or remove all smtpoptions and it sends emails again with a certificate. 像c:\\ certs \\ cacert.pem一样,然后重新启动Apache服务器,然后将verify_peer更改为true或删除所有smtpoptions并再次发送带有证书的电子邮件。 Unsure if it works with any other certs but did with the one I downloaded from the site listed on troubleshooting PHPMailer page on GitHub. 不确定它是否可以与任何其他证书一起使用,但不能与我从GitHub上的PHPMailer页面进行故障排除时列出的站点下载的证书一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM