Page 1 of 1

Yet another mail() question

Posted: Tue Jan 13, 2009 9:15 am
by Monstamash
Sorry to post yet another question, I have hunted this forum but couldn't find an answer.

I have been doing some testing with a very simple mail script.

Code: Select all

<?php
$to = "myemail@hotmail.com";
//$to = "myemail@googlemail.com";
$subject = "My subject";
$txt = "Hello!";
$headers = "From: noreply@pact-oil.co.uk\r\n";
if (mail($to,$subject,$txt,$headers)) {
    echo "Success";
} else {
    echo "Failed";
}
?>
I always get "Success" when I run the script. When I'm using my googlemail email account as the to the email arrives almost instantly. When I change over to my hotmail account as the to the email never arrives, not even in spam. Anyone got any idea why?

Re: Yet another mail() question

Posted: Tue Jan 13, 2009 9:38 am
by aceconcepts
Don't know if you want it sent as plain text or HTML but here you go.

Add the following header:

Code: Select all

 
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
 

Re: Yet another mail() question

Posted: Wed Jan 14, 2009 10:31 am
by Monstamash
Hi, Thanks for your reply. I added the extra header info but still the exact same results. Its just a simple plain text email I want to send. Very peculiar behaviour. I'm completely stumped! :banghead: