简体   繁体   English

php邮件发送到手机/短信/短信; 通过标题丢失

[英]Php mail out to mobile / sms / text; missing from, via headers

For some reason, when php mail() is sent to a text number (via email) ie 123456789@vtext.com; 由于某些原因,当php mail()发送到一个文本号(通过电子邮件)时,即123456789@vtext.com; the from shows up as the centos apache server output email (apache@host-name.com). 从显示为centos apache服务器输出电子邮件(apache@host-name.com)。 However, I've included the correct headers; 但是,我提供了正确的标题。 so when the same mail() is pushed to (for example) gmail it comes and shows normal with all the correct headers / mime type / from. 因此,当将同一个mail()推送到(例如)gmail时,它就会出现并显示正常,并带有所有正确的标头/ mime类型/来自。

Any idea? 任何想法?

Here's the code for the normal mail 这是普通邮件的代码

$headers = "From: Alert@thedomain.com \r\n";
$headers .= "Date: ". date('r') . "\r\n"; 
$headers .= "Content-Type: text/html; charset=utf-8"; 
$headers .= "MIME-Version: 1.0 ";   
$body = "body message";
mail($userinfo->username,"thedomain",$body,$headers);

And the code for the mobile: (We don't use date/content type/ mime for text msgs, or else the headers shows up in the txt msg) 以及移动设备的代码:(我们不对文本味精使用日期/内容类型/ MIME,否则标题将显示在txt味精中)

$headers = "From: Alert@thedomain.com \r\n";    
$body = "body message";
mail($userinfo->mobile,"thedomain",$body,$headers);

Try sending with the additional -f flag to the mail function: 尝试将附加的-f标志发送到邮件功能:

mail($userinfo->username,"thedomain",$body,$headers, "-ffromaddress@example.com");

See the manual for more information on additional parameters 有关其他参数的更多信息, 请参见手册

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

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