Problems using mail() function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Problems using mail() function

Post by mjseaden »

Dear All,

I have looked on Google to try and find an answer to this seemingly basic problem, however no joy.

I'm trying to use the PHP mail() function to send a single simple e-mail to a mail account. However, when I try and execute the mail() function I get the following error message:

Warning: mail(): SMTP server response: 554 <mail@mail.com>: Recipient address rejected: Relay access denied in \\XXXXXX\domains\s\mydomain.biz\user\htdocs\index.php on line XXXX

Obviously it's an SMTP problem, however I am not knowledgable of either the cause or the underlying issues.

Can anyone explain what is going on?

Many thanks again

Mark
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Problems using mail() function

Post by TheBentinel.com »

mjseaden wrote: Warning: mail(): SMTP server response: 554 <mail@mail.com>: Recipient address rejected: Relay access denied in \\XXXXXX\domains\s\mydomain.biz\user\htdocs\index.php on line XXXX
The error means that the SMTP server is unwilling to send mail to other domains. If your server is "myserver.com" then it would probably be willing to accept mail for "dave@myserver.com", but not for "dave@someserver.com".

You need to talk to your hosting provider about allowing you to send mail. You won't be able to fix it from PHP.

You could, though, use sockets to connect to your own SMTP server. There's a note about that in the manual page for mail, I think:
http://www.php.net/mail
Post Reply