I have this code for sending mail in 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');
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: <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>
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?