Page 1 of 1

Using mail function

Posted: Wed Nov 25, 2009 2:33 am
by rid243
Hi all,

I get strange outputs from my email function. My code:

//START
$headers = "From: Richard <richard@email.com>\n";
$headers .= 'Bcc: richard@email.com' . "\r\n";
$headers .= "Return-Path: <richard@email.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n";

$subject = 'email confirmation';
$to = $email;

$body .= " * Melbourne: (03) 9000 0000<br>";
$body .= " * Newcastle: (02) 9000 0000<br>";
$body .= " * Perth: (08) 9000 0000<br>";
$body .= " * Rockhampton: (07) 9000 00000<br>";
$body .= " * Sydney: (02) 9000 0000<br>";

mail($to, $subject, $body, $headers, "-f richard@email.com");
//END

For some reason, it generates the email perfectly fine in several instances, but then it gives something like "* Melbourne: (03) 9000 00 00" in the output -- i.e. it adds a space between the four 0's. In another instance, the "<br>" tag was displayed. I'm viewing all of these emails from Gmail and can't understand why it's not consistent?

Any pointers, suggestions etc would be great.

Thanks in advance!

Re: Using mail function

Posted: Wed Nov 25, 2009 3:15 am
by requinix
Could have something to do with the improper headers. They should have a \r\n between each - like you did with Bcc.