Mail Function showing header info

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cesarcesar
Forum Contributor
Posts: 111
Joined: Mon Oct 18, 2004 3:28 pm

Mail Function showing header info

Post by cesarcesar »

I am using a standard mail function within an AMFPHP Class that i have used many times. Now, when i use it it does not work right. When a mail is sent, the $header info and html shows in the email.

I would like to know why the header info is showing in the email, along with why the HTML code is not rendering. I will post examples of code and result. Please provide a solution b4 i pull my hair out.

Running PHP 4.3.9 on Apache

Code: Select all

function sendMail($vars) {

$email = "visitor@site.com";

$headers  ="MIME-Version: 1.0\r\n";
$headers .= "From: {$email}\r\n";
$headers .= "Return-Path: {$email}\n";
$headers .= "Reply-To: {$email}\n";
$headers .= "Message-Id: <".time()."@".$_SERVER['SERVER_NAME'].">\n";
$headers .= "X-Mailer: php-mail-function-0.2\n";

$content = "<b>test</b>";

mail("email@example.com", "Subject", $content, $headers);
}
This is the email that is returned.

Code: Select all

From: visitor@site.com
Reply-To: visitor@site.com
Message-Id: <1185426433@www.example.com>
X-Mailer: php-mail-function-0.2

<b>test</b>
cesarcesar
Forum Contributor
Posts: 111
Joined: Mon Oct 18, 2004 3:28 pm

Post by cesarcesar »

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Better solution - use Swiftmailer.
cesarcesar
Forum Contributor
Posts: 111
Joined: Mon Oct 18, 2004 3:28 pm

Post by cesarcesar »

thanks for the swift mailer info. I will use it and take the go PHP 5 pledge. enjoy your time in the AU.
Post Reply