Forum Moderators: coopster
I get this warning:
Warning: mail() [function.mail]: SMTP server response: 550 <email@example.com> No such user here in D:\Domains\example.com\wwwroot\mail.php on line 3
when using this simple code:
<?php
error_reporting(E_ALL);
if(mail('email@example.com','subj','mess')) print "sent.";
else print "not sent";
?>
What does this warning mean? any solution?
Thanks for any help.
From the mail() manual page [uk.php.net]:
Note: When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini.
Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows.
Bit of a long shot but... have you tried a more verbose example with a longer subject and message text, perhaps spanning several lines (separated with '\n'). Just in case the mail server is rejecting 'nonsense' emails?! (Just a thought)
the trick here being that it's a mail error550 means, as it showed, no such user or just that the user mailbox was unavailable. I also found mention of that error being the not allowed to relay as well. Are you using an address that you have sent with before?
yes again! This script works well on other domains with the same email address...
Thank to all anyway...
[edited by: Msd192 at 12:34 pm (utc) on May 11, 2008]
but isn't that the point, this mail server doesn't like the address, doesn't really seem to have much to do with the script
try using another address that is valid on the mail server you are sending through
Are you sure your web host has enabled the mail() function for your website.
If mail() does not work for you, you have options, too. The mail() function included with stock PHP does not support SMTP authentication, for example. If mail() does not work for you for this or another reason, try the PEAR Mail package, which is much more comprehensive and sending mail almost as easily from your PHP scripts.
I dont know anything about it(PEAR), I should give it a try.