我曾嘗試,但收效甚微如下:PHP郵件()使用發送郵件「匿名@ ...」
$fromEmail = "something.com <[email protected]>\r\n";
$headers = 'From: '.$fromEmail;
$headers .= 'Reply-To: '.$fromEmail;
$headers .= 'Return-Path: '.$fromEmail;
$headers = 'MIME-Version: 1.0' . '\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';
if(mail($to, $subject, $message, $headers)) { echo "1"; exit; }
我已經嘗試註釋掉Reply-To:
和Return-Path:
線以及更換if(...
線搭配:
if(mail($to, $subject, $message, $headers,'[email protected]')) { ...
在電子郵件到達所有的情況,但是從[email protected]
你錯過了CR在MIME版本頭( 'R \ n''的\'而不是''\ n'')。另外,似乎在'$ fromEmail'中包含CRLF是一個壞主意 - 我將它放在構建頭文件的代碼中。 – tomlogic 2012-01-04 00:02:25