Failed to connect to mailserver

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
This issue is really annoying me, I dont know why its happening.

I did a PHP site for a client and it uses the php mail() function.

The site is now live and works fine. It seems that whenever a user who
is internal to the site as in, if they use the site from within the
network that the site is served. The mail function fails with:

Warning: mail() [function.mail]: Failed to connect to mailserver at
"theServer" port 25, verify your "SMTP" and "smtp_port" setting in
php.ini or use ini_set() in (...the php.ini file)

(I have changed the name of the server and the file path to the php.ini
here for security reasons.)

But!! When I use the site from an external computer, like anyone else
would, it works fine. Im yet to confirm weather every email request
from an external site works ok. But I think so.

What could be the problem? Would it matter that the request to the web
server is internal or not?

Re: Failed to connect to mailserver

maybe there is something wrong with the servername "theServer".

if the SMTP mail server is running on the same host as PHP, "at

SMTP = localhost

in your php.ini.

Or use the mail server of your provider and set

SMTP = the provider's mail server fully qualified domain name

so what "theServer" equal to  ?

Re: Failed to connect to mailserver

This could be that the mailserver is not setup to receive requests
locally. You should attempt to ping the mailserver using the same name
as the script is. If that works, telnet to the mailserver on port 25.
If it doesn't great, simple problem. Mod the MTA configuration to
accept connections from local address.

Re: Failed to connect to mailserver

Thanks Darkstar, that may just work Ill let you know once I have a go.

mannerboy, the server is fine, the naming here is definatly not the
problem, because all external requests work fine.

Site Timeline