PHP mail()

Status
Not open for further replies.

nicolassima89

New Member
Messages
5
Reaction score
0
Points
0
Hi,

I want to send automated email messages from my PHP application in direct response to a user's action but the PHP mail() function doesn't seem to work. Is there anyway we can fix that?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
PHP mail() is enabled and should be working on all free servers. The email server can be finicky about some things like the "From" header (to prevent outgoing spam).
Also, some email hosts regrettably label mail from x10 as 'spam' due to past abuses. So you might have to check spam folders. Also, check your hosting account webmail in case they are being bounced back.
If you post the PHP code your script uses to mail maybe we can find any other problems.
 

nicolassima89

New Member
Messages
5
Reaction score
0
Points
0
Thank you for your quick reply.

I tryed runnin this simple script:

<?php
$to = "nicolassima89@hotmail.com";
$subject = "Test";
$message = "Test.";
$from = "someone@example.com";
$headers = "From: $from";
if (mail($to,$subject,$message,$headers))
echo "Mail Sent.";
else
echo "Error.";
?>

and I get Error and never get any email in my inbox or my spam/junk box.

even this won't work:

<?php
if (mail("nicolassima89@hotmail.com","test","test","From: nicolassima89@nick89.x10.mx"))
echo "Mail Sent.";
else
echo "Error.";
?>

Thank you!
Nick
 

nicolassima89

New Member
Messages
5
Reaction score
0
Points
0
Ok so just to make sure I also tryed this:

<?php

// mail() test

error_reporting(E_ALL);

$ToName = "Someone";
$ToEmail = "nicolassima89@hotmail.com";

$FromName = "Me";
$FromEmail = "nicolassima89@nick89.x10.mx";



// TEST 1

$email = "$ToName <$ToEmail>";
$from = "$FromName <$FromEmail>";

$subject="Testing Minimal Mail Functionality #1";
$message="Minimal Mail Functionality Test #1 Seems to Be Working!";

if(mail("$email","$subject","$message","From: $from")){
echo "email #1 sent !!! </br>";
}else{
echo "email #1 error !!! </br></br>";
}



// TEST 2

$email = "$ToEmail";
$from = "$FromEmail";

$subject="Minimal Mail Functionality #2";
$message="Minimal Mail Functionality Test #2 Seems to Be Working!";

if(mail("$email","$subject","$message","From: $from")){
echo "email #2 sent !!! </br>";
}else{
echo "email #2 error !!! </br></br>";
}



// TEST 3

$email = "$ToEmail";

$subject="Testing Minimal Mail Functionality #3";
$message="Minimal Mail Functionality Test #3 Seems to Be Working!";

if(mail("$email","$subject","$message")){
echo "email #3 sent !!! </br>";
}else{
echo "email #3 error !!! </br></br>";
}

?>

and I get the error on all 3 emails!

nothing in spam, nothing came back to my from email....

thanks in advance!
Nick
 

nicolassima89

New Member
Messages
5
Reaction score
0
Points
0
OK, now I get the "mail sent !!!" instead of "Error" message but the email never gets to my inbox!

Is anyone working on anything?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
It should be bouncing back to your x10.mx mailbox.

Apparently all the abuse by some members has convinced both hotmail and yahoo to just bounce the emails back. Not even put them in the spam folder.
 

nicolassima89

New Member
Messages
5
Reaction score
0
Points
0
Wow, that really ruins everything! all right then, I guess I'm going host hunting again :(

Thank you anyways,
Nick
 

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Good luck, since you seem to be all set I am going to close this.
 
Status
Not open for further replies.
Top