![](/img/trans.png)
[英]Inserting '2011-12-20, 3:18PM EST' into MySQL Timestamp Column
[英]phpmailer was working as of 12/4 prior to 2pm est
好的,即時消息在30小時后不間斷地嘗試找出此代碼,以了解為什么它突然冒出來停止工作,並且現在真的讓我生氣。
它是生產服務器,直到標題時間都可以正常工作。
這是我的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!';
}
?>
更新:
我從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
)
);
就在if(!$ mail行之前。這是一個臨時解決方案,而我想知道為什么ssl證書會從錯誤的位置拉出它,以及在哪里設置正確的位置。它從/ usr / local / ssl那里拉出東西是Windows機器,認為它是Linux機器,也沒有使用任何預包裝的amp系統,im僅使用所有單獨的安裝,apache / php / mysql都單獨使用。
費:
設置為true的verify_peer是導致問題的原因。 您可以將其他任何內容更改為true / false,然后它將發送。 一旦將verify_peer更改為true,它就會停止。
正確修復。 在“ PHPMailer故障排除”下,下載一個新的cacert.pem,並在php.ini內滾動至底部(至少我的底部),或搜索cafile或capath並添加路徑和文件。 文件必須是它的完整路徑,因為它給了我一個錯誤,不是。 像c:\\ certs \\ cacert.pem一樣,然后重新啟動Apache服務器,然后將verify_peer更改為true或刪除所有smtpoptions並再次發送帶有證書的電子郵件。 不確定它是否可以與任何其他證書一起使用,但不能與我從GitHub上的PHPMailer頁面進行故障排除時列出的站點下載的證書一起使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.