Page 1 of 1
php mail() does not work?
Posted: Fri Nov 14, 2008 7:34 am
by Sindarin
I tried this simple mail script on 2 servers but it says the delivery failed. Both servers use PHP5.
Code: Select all
<?php
$to = "mymail@mydomain.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>");
}
?>
Re: php mail() does not work?
Posted: Fri Nov 14, 2008 8:01 am
by Jaxolotl
did you check the smtp configuration on your php.ini?
Re: php mail() does not work?
Posted: Fri Nov 14, 2008 9:07 am
by Sindarin
sendmail_from and sendmail_path has no value in the Windows server.
sendmail_from has the value of
php@mail14.awardspace.com and sendmail_path is /usr/sbin/sendmail -oi -t in the Linux one.
The smtp port is 25 and both use localhost as SMTP value.
Re: php mail() does not work?
Posted: Mon Nov 17, 2008 6:26 am
by Sindarin
I found the solution with my own host. Problem was the host required authentication, that is a valid "from" header to the script and an inbox created with that email.
Problems on the Windows server still occur though, the server throws the error:
Warning: mail() [function.mail]: SMTP server response: 421 4.1.0 Dropping connection due to an error on this server in D:\Sites\send.php on line 8
Re: php mail() does not work?
Posted: Mon Nov 17, 2008 6:49 am
by Jaxolotl

, good!!! scuse me but I was smashed down with a lot of work the last week and I didn't even open the forum.
Namarië