[英]What would prevent WordPress from sending emails to non-local email addresses?
[英]PHPMailer suddenly stops sending emails to non-local email addresses
因此,我正在使用PHPMailer向用戶發送預訂確認電子郵件。 它已經工作了幾個月,但是突然之間,它就停止了工作。 什么都沒改變(至少我什么都沒改變)。 PHPMailer文件仍然完整,我沒有處理DNS / MX記錄。 這是發送電子郵件的腳本。 它通過我的本地電子郵件地址向用戶發送一個,向我發送一個。 發送給我的電子郵件已成功發送,但客戶端未收到。 當我嘗試僅將其發送給客戶端時,調試信息顯示電子郵件已發送。 當提及收件人地址時(我認為這表示接受),它總是說250 OK
。 它還顯示了整個消息,然后最后關閉了連接。 在腳本中,它還應echo "true"
,並執行此操作。 不過,我沒有收到電子郵件。 順便說一句,我正在使用PHPMailer,特別是下面腳本中的include中提到的兩個文件
這是實際發送電子郵件的腳本。
<?php
include "connection.php";
session_start();
if(isset($_POST['problem_name'])){
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$model_name = $_POST['model_name'];
$problem_name = $_POST['problem_name'];
$package_name = $_POST['package_name'];
$price = $_POST['price'];
$query = "INSERT INTO ext_orders (`date`, `name`, `address`, `phone`, `email`, `product`, `problem`, `package`, `addons`, `price`) VALUES ('".date("Y/m/d")."', '".$name."', '".$address."', '".$phone."', '".$email."', '".$model_name."', '".$problem_name."', '".$package_name."', 'No', ".intval($price).")";
if(mysqli_query($link, $query)){
$latest_id = mysqli_insert_id($link);
/***** COMPOSING OF EMAIL TO CUSTOMER AND A BCC TO MOBILECARE ******/
$message=
'
<h1>Mobilecare Urgent Repair Order Confirmation</h1> <br />
<h3> Personal Details </h3><br/>
<b>Name:</b> '.$name.'<br />
<b>Urgent Repair Address:</b> '.$address.'<br />
<b>Email:</b> '.$email.'<br />
<b>Phone Number:</b> '.$phone.'<br />
<h3> Product and order details </h3><br/>
<b>Model:</b> '.$model_name.'<br/>
<b>Type of Repair:</b> '.$problem_name.'<br/>
<b>Price:</b> '.$price.'<br/><br/>
If there are any problems with the information above, please reply to this email!<br/><br/>
Thank you,<br/>
Mobilecare.
';
include "../phpmailer/class.smtp.php";
include "../phpmailer/class.phpmailer.php";
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
$mail->SMTPDebug = true;
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->Host = localhost;
//Set who the message is to be sent from
$mail->setFrom('info@coherenthub.com', 'Mobilecare'); // info@mobilecare.ae
//Set an alternative reply-to address
//$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress(''.$email.'', ''.$name.'');
// $mail->AddBCC("info@coherenthub.com", "Mobilecare"); // info@mobilecare.ae
//Set the subject line
$mail->Subject = 'Mobilecare Order Confirmation';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->MsgHTML($message);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
if ($mail->send()) {
echo "true";
}
}
else{
echo "fail";
}
}
?>
所有的答案和評論將不勝感激。
我曾嘗試: -注釋掉$mail->isSMTP()
-與MX記錄播放(恢復所有變化,雖然) -重新下載PHPMailer的(最新版)
您正在發送到localhost,這意味着您正在提交到本地郵件服務器。 這意味着無論使用isMail
還是isSMTP
,您都將獲得相同的結果。 聽起來提交工作正常(您的250 OK
結果),但是從郵件服務器繼續發送則無效。 這意味着您的PHPMailer代碼沒有任何問題,但是您需要檢查郵件服務器日志和配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.