Link to home
Start Free TrialLog in
Avatar of Timelib
Timelib

asked on

When using mail function, "!" is added to the results. Why?

Greetings,

Over the past few months I've been increasing my use of the mail function in php. However, I'm finding a issue with the results (the e-mail that is recieved).

The e-mail returns "!" through out the text of the e-mail, which was not there when it was send.

Example:
My page i!s done.

Is there a way around this, or a way to remove the "!"?
Avatar of diverdiver
diverdiver

An example of your mail function would help!

diverdiver
Avatar of Timelib

ASKER

The simple example I can give is this:

<?
$mail_body = "";
for ($i=0; $i <500; $i++) {
$mail_body .=
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>" . chr(13);
}    

$MailSubject = "Testing";

$msg = $mail_body;

$EmailAddress = "your@name.com";
$sender_email = "cbrady@sbccd.cc.ca.us";
$mailheaders = "From: \"Test Server\" <webmaster@name.com>\n";
$mailheaders .= "Reply-To: $sender_email\n";
$mailheaders .= "Content-Type: text/html\n";
mail($EmailAddress, $MailSubject, $msg, $mailheaders);

?>
Avatar of Timelib

ASKER

I've done a little more investigating and found that unix and windows handle file a little different.

For unix you need to use a "\n" or chr(10); which is a carrage return only.

For windows you need to use a "\r\n" or chr(13); which is a carrage return, new line.

I found the info on the following web page:
http://bugs.php.net/bug.php?id=13342

Easy 200 points, if you agree to this solution so I can close this question.
ASKER CERTIFIED SOLUTION
Avatar of diverdiver
diverdiver

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Timelib

ASKER

The proposed answer is above selected answer.