[英]php mail function - how can changing From: in header cause email not to be sent?
The one email From:support@lead.com works fine. 发一封电子邮件来自:support@lead.com可以正常工作。 But when changed to john.doe@lead.com it doesn't work?
但是,当更改为john.doe@lead.com时,它不起作用吗? See below.
见下文。
Both are valid email addresses (fictitious for this example) in the domain from which they are sent. 两者都是在其发送域中的有效电子邮件地址(在此示例中为虚拟)。
I have the question into Netfirms support too. 我也有对Netfirms支持的问题。 I expect to move to phpmailer or API to a ESP (eg, mailchimp) account soon, but this is just bugging me that the little change breaks the email function.
我希望很快就可以将phpmailer或API转移到ESP(例如mailchimp)帐户,但这只是让我感到困惑,因为一点点改动都破坏了电子邮件功能。
Code: 码:
Works: 作品:
$headers = "Mime-Version: 1.0\n";
$headers .= "Content-Type: text/html;charset=UTF-8\n";
$headers .= 'From: support@lead.com' . "\r\n";
$headers .= 'Bcc: bcc@lead.com' . "\r\n";
// $headers .= 'Return-Path: bcc@lead.com' . "\r\n";
mb_internal_encoding("UTF-8");
if (!mail($to, $subject, $body, $headers, "-f bcc@mylead.com")) echo ("Message delivery failed");
Doesn't Work: (only changed support to john.doe): 不起作用:(仅更改对john.doe的支持):
$headers = "Mime-Version: 1.0\n";
$headers .= "Content-Type: text/html;charset=UTF-8\n";
$headers .= 'From: john.doe@lead.com' . "\r\n";
// $headers .= 'Return-Path: bcc@lead.com' . "\r\n";
mb_internal_encoding("UTF-8");
if (!mail($to, $subject, $body, $headers, "-f bcc@lead.com")) echo ("Message delivery failed");
不知道这到底有多重要,但是您在标头中混合了\\ n和\\ r \\ n,这可能会使您的邮件服务器感到困惑……您介意尝试一下吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.