PHPでメールを送信するためのこのコードがあります:
$headers = "Content-type: text/html;\r\n";
$headers .= 'From: "Registration" <registration@site.com>' . "\r\n";
$headers .= "Reply-To: registration@site.com\r\n";
$headers .= "Return-Path: registration@site.com\r\n";
$mailresult = mail($to, $subject, $message, $headers, '-f registration@site.com');
メールが送信され、差出人アドレスが正しく設定され、ほぼ完全に機能しています。
問題は、メールの本文に、、、およびフィールドが含まれているFrom:
ことReply-To:
ですReturn-Path:
。これは、Gmail インターフェースでどのように見えるかのスナップショットです。
生のヘッダーは次のようになります。
X-PHP-Originating-Script: 33:mailtest.php
Content-type: text/html;
Message-Id: <20130316153738.AA739118073@server.com>
Date: Sat, 16 Mar 2013 15:37:38 +0000 (UTC)
From: registration@site.com
From: Registration <registration@site.com>
Reply-To: registration@site.com
Return-Path: registration@site.com
<html>
最初のFrom:
ものは実際のヘッダー内にあるようです。2 番目From:
以降、 まで<html>
はすべて本体内にあります。
これらのヘッダー フィールドを電子メール本文から取得し、それらが属するヘッダーに挿入するにはどうすればよいですか?