Page 1 of 1

Spurious character in email sent with mail()

Posted: Fri Feb 11, 2011 3:53 pm
by JeffG
I have the following code which sends an email to the maintainer (who happens to be me :) ):

Code: Select all

            // Compose and send the email
            $headers = "From: $mail_from_address"."\r\n";
            $headers .= "Reply-To: $mail_from_address"."\r\n";
            $headers .= "X-Mailer: PHP/".phpversion();

            $message = "To:   Maintainer\nFrom user: $username\n\n";
            $message .= $text;
            ini_set("track_errors", "1");
            ini_set("SMTP", $mail_smtp_host);
            $sent = mail($maint_email, $email_prefix." - ".$subject, $message, $headers);
 
The message body which is delivered is as follows:

Code: Select all

To:   Maintainer
>From user: jeff

This is a test.
Where is the spurious '>' coming from?

(Using PHP 5.2.5 on Windows 7. Browser is Firefox.)

Re: Spurious character in email sent with mail()

Posted: Fri Feb 11, 2011 4:02 pm
by John Cartwright
Your mail server is doing it for whatever reason, I have not a clue.

What happens if you try

Code: Select all

$message = "To: Maintainer\r\n";
$message.= "From user: $username\r\n";
$message.="\r\n";

Re: Spurious character in email sent with mail()

Posted: Wed Feb 16, 2011 7:35 am
by JeffG
It made no difference. A weird anomaly, but something I can live with. Thanks anyway.