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'] == '[email protected]' || $_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 <[email protected]>\r\n";
mail('[email protected]', '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'] == '[email protected]' || $_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 <[email protected]>\r\n";
mail('[email protected]', 'Test', 'Test HTML', $headers); 
echo 'Yeah';
}

But when I changed [email protected] 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?

May I suggest you do this:

 

$sendmail = mail('[email protected]', '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".

May I suggest you do this:

 

$sendmail = mail('[email protected]', '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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.