...

View Full Version : Php mail



alcool9999
09-10-2009, 04:13 PM
Hi i have this php mail script and it says message sent successfuly but i never recieve the message.
any help apreciated.

i know my email address needs to go where "you@someone.com" is so thats not the problem.
code:

<?php
$to = "you@someone.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

angst
09-10-2009, 04:16 PM
could be a few things.

a) have you checked your spam folder?
b) is apache/linux correctly configured with with sendmail?

c) try adding headers:



<?php
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

alcool9999
09-10-2009, 04:18 PM
headers doesn't work.
how can i check if it is configured correctly.
thanks

angst
09-10-2009, 04:20 PM
what do you mean headers don't work? in what way do they not work??

yes, normally a good test would be to use the mail function which you are trying now.

use the default script that I posted ( right from the manual ), configure it with your email address and test it. post back if theres an error.

alcool9999
09-10-2009, 04:22 PM
i used the script you posted but still no luck. it doesn't say theres any errors i just don't recieve the email

angst
09-10-2009, 04:23 PM
did you get an error? and did you check your spam folder?

alcool9999
09-10-2009, 04:23 PM
no errors and yes i checked my spam folder.

angst
09-10-2009, 04:25 PM
hmm, not sure what I can do for you then, you can try and call your host and have them look into this. also it may be that your host/server ip has been black listed. but as for the php itself. it should work as is.

alcool9999
09-10-2009, 04:26 PM
ok thanks for your help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum