php 使用 mailgun smtp 的邮件被 gmail 阻止;错误 RFC 5322
php mail using mailgun smtp blocked by gmail; error RFC 5322
我在过去 24 小时内从 gmail 服务器收到以下间歇性错误(发送到 gsuite 帐户或 gmail 帐户时)。并非所有消息都会发生这种情况。即使是同一条消息也失败了一次,然后又成功了。我正在寻找解决此问题的方法。我不确定这是 headers 还是 gmail 做错了什么。
我有一个用于 mailgun 的专用 IP,除了 gmail 之外没有收到任何其他错误。
这是错误:
5.7.1 [69.72.33.194 11] Our system has detected that this message is 5.7.1 not RFC 5322 compliant: 5.7.1 'From' header is missing. 5.7.1 To reduce the amount of spam sent to Gmail, this message has been 5.7.1 blocked. Please visit 5.7.1 https://support.google.com/mail/?p=RfcMessageNonCompliant 5.7.1 and review RFC 5322 specifications for more information. p18si54042ood.13 - gsmtp
发送电子邮件的代码:(使用 mailgun 通过 postfix)
$lead_email = BCC_EMAIL;
$cc_email = LEAD_CC_NOTIFICATION_EMAIL;
$message = <<<MSG
<p>Hi PHP POS Admin,</p>
<p>You have received a TRIAL CONVERSION from the customer below: </p>
<ul>
<li>Company: $data[company]</li>
<li>Name: $data[name]</li>
<li>E-Mail: $data[email]</li>
<li>Phone: $data[phone]</li>
<li>Provider: $data[payment_provider]</li>
<li>Address: <strong>$data[country]</strong> $data[address_1] $data[address_2] $data[city] $data[state], $data[zip]</li>
<li>IP Address: $data[ip_address]</li>
<li>IP Address Location: $data[ip_geo]</li>
</ul>
Regards<br>
</p>
MSG;
$from = $lead_email;
$subject = 'SUBJECT';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: ".$from . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
mail($lead_email, $subject, $message, $headers);
原始 MIME:
Received: by REDACTED (Postfix, from userid 48)
id 91F58812D2; Tue, 19 May 2020 17:51:59 +0000 (UTC)
To: REDACTED
Subject: REDACTED
X-PHP-Originating-Script: 500: REDACTED
MIME-Version: 1.0
From: example@example.com
Content-type: text/html; charset=UTF-8
Message-Id: < REDACTED >
Date: Tue, 19 May 2020 17:51:59 +0000 (UTC)
<p>Hi PHP POS Admin,</p>
<p>You have received a TRIAL CONVERSION from the customer below: </p>
<ul>
<li>Company: REDACTED</li>
<li>Name: REDACTED </li>
<li>E-Mail: REDACTED </li>
<li>Phone: REDACTED </li>
<li>Provider: braintree</li>
<li>Address: <strong> REDACTED </strong> , REDACTED </li>
<li>IP Address: REDACTED </li>
<li>IP Address Location: , , </li>
</ul>
Regards,<br>
PHP Point Of Sale Team
</p>
我最终使用了 phpmailer,因为它管理所有 headers。到目前为止有效
我在过去 24 小时内从 gmail 服务器收到以下间歇性错误(发送到 gsuite 帐户或 gmail 帐户时)。并非所有消息都会发生这种情况。即使是同一条消息也失败了一次,然后又成功了。我正在寻找解决此问题的方法。我不确定这是 headers 还是 gmail 做错了什么。
我有一个用于 mailgun 的专用 IP,除了 gmail 之外没有收到任何其他错误。
这是错误:
5.7.1 [69.72.33.194 11] Our system has detected that this message is 5.7.1 not RFC 5322 compliant: 5.7.1 'From' header is missing. 5.7.1 To reduce the amount of spam sent to Gmail, this message has been 5.7.1 blocked. Please visit 5.7.1 https://support.google.com/mail/?p=RfcMessageNonCompliant 5.7.1 and review RFC 5322 specifications for more information. p18si54042ood.13 - gsmtp
发送电子邮件的代码:(使用 mailgun 通过 postfix)
$lead_email = BCC_EMAIL;
$cc_email = LEAD_CC_NOTIFICATION_EMAIL;
$message = <<<MSG
<p>Hi PHP POS Admin,</p>
<p>You have received a TRIAL CONVERSION from the customer below: </p>
<ul>
<li>Company: $data[company]</li>
<li>Name: $data[name]</li>
<li>E-Mail: $data[email]</li>
<li>Phone: $data[phone]</li>
<li>Provider: $data[payment_provider]</li>
<li>Address: <strong>$data[country]</strong> $data[address_1] $data[address_2] $data[city] $data[state], $data[zip]</li>
<li>IP Address: $data[ip_address]</li>
<li>IP Address Location: $data[ip_geo]</li>
</ul>
Regards<br>
</p>
MSG;
$from = $lead_email;
$subject = 'SUBJECT';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: ".$from . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
mail($lead_email, $subject, $message, $headers);
原始 MIME:
Received: by REDACTED (Postfix, from userid 48)
id 91F58812D2; Tue, 19 May 2020 17:51:59 +0000 (UTC)
To: REDACTED
Subject: REDACTED
X-PHP-Originating-Script: 500: REDACTED
MIME-Version: 1.0
From: example@example.com
Content-type: text/html; charset=UTF-8
Message-Id: < REDACTED >
Date: Tue, 19 May 2020 17:51:59 +0000 (UTC)
<p>Hi PHP POS Admin,</p>
<p>You have received a TRIAL CONVERSION from the customer below: </p>
<ul>
<li>Company: REDACTED</li>
<li>Name: REDACTED </li>
<li>E-Mail: REDACTED </li>
<li>Phone: REDACTED </li>
<li>Provider: braintree</li>
<li>Address: <strong> REDACTED </strong> , REDACTED </li>
<li>IP Address: REDACTED </li>
<li>IP Address Location: , , </li>
</ul>
Regards,<br>
PHP Point Of Sale Team
</p>
我最终使用了 phpmailer,因为它管理所有 headers。到目前为止有效