I have this code for sending mail in PHP:
$headers = "Content-type: text/html;\r\n";
$headers .= 'From: "Registration" <[email protected]>' . "\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "Return-Path: [email protected]\r\n";
$mailresult = mail($to, $subject, $message, $headers, '-f [email protected]');
The mail sends, the from address is set correctly, and it's working almost perfectly.
The problem is that the mail includes the From:
, Reply-To:
, and Return-Path:
fields in the body of the mail. Here is a snapshot of what it looks like in my Gmail interface:
Here is what the raw headers look like:
X-PHP-Originating-Script: 33:mailtest.php
Content-type: text/html;
Message-Id: <[email protected]>
Date: Sat, 16 Mar 2013 15:37:38 +0000 (UTC)
From: [email protected]
From: Registration <[email protected]>
Reply-To: [email protected]
Return-Path: [email protected]
<html>
The first From:
seems to be within the actual headers. The second From:
, and everything after that down to to <html>
is in the body.
How do I get these header fields out of the email body and into the header where they belong?