Jump to content

[SOLVED] Using the PHP mail() Function With Hotmail Accounts...


trecool999

Recommended Posts

Ok people, here's my problem...

 

I've got a mail script:

 

function Func() {
if($_POST['To'] == '' || $_POST['To'] == 'Name@Server.com' || $_POST['Subject'] == '') {
	die('Not all the required fields are filled in.');
}
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Chris Kay <raf_dude@hotmail.co.uk>\r\n";
mail('raf_dude@hotmail.co.uk', 'Test', 'Test HTML', $headers); 
echo 'Yeah';
}

If you can already spot what the error is, you're amazing, because I can't. I managed to send an email to myself succesfully when the script was like this:

 

function Func() {
if($_POST['To'] == '' || $_POST['To'] == 'Name@Server.com' || $_POST['Subject'] == '') {
	die('Not all the required fields are filled in.');
}
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Chris Kay <visitor@gmail-or-other.com>\r\n";
mail('raf_dude@hotmail.co.uk', 'Test', 'Test HTML', $headers); 
echo 'Yeah';
}

But when I changed visitor@gmail-or-other.com to my Email it stops sending the Emails...

 

I've tried to find one mailer on the net that works, because at first I thought my one didn't work because I'd coded it wrong... Turns out even the PEAR mailer won't send it to me either... Anyone have an answer?

Link to comment
Share on other sites

May I suggest you do this:

 

$sendmail = mail('raf_dude@hotmail.co.uk', 'Test', 'Test HTML', $headers); 

if($sendmail) {
  echo "Mail sent successfully";
}
else {
  echo "Failure... mail not sent";
}

 

It will help determine if the mail() function actually "succeed" or "fails".

Link to comment
Share on other sites

May I suggest you do this:

 

$sendmail = mail('raf_dude@hotmail.co.uk', 'Test', 'Test HTML', $headers); 

if($sendmail) {
  echo "Mail sent successfully";
}
else {
  echo "Failure... mail not sent";
}

 

It will help determine if the mail() function actually "succeed" or "fails".

 

I already tried that. Apparently it succeeds so I'm now starting to think that it is a problem with Hotmail because when I used it again sending it to my website email, both SquirrelMail and Horde picked it up...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.