Page 1 of 1

Problem with mail() on Win2003 Server

Posted: Wed May 25, 2005 10:52 am
by anpal
Hello everybody

I'm running Windows 2003 Server + IIS6 + PHP.
Now I've tried to send mail with php and got the following error:

Code: Select all

Warning: mail(): Failed to connect to mailserver at &quote;localhost&quote; port 25, 
verify your &quote;SMTP&quote; and &quote;smtp_port&quote; setting in php.ini or 
use ini_set() in c:\inetpub\wwwroot\testmail.php on line
The fact is that I have got SMTP server instaled on this machine on 25th port.
And SMTP server does work (I can send email throuht it, but not with php).

I also tried to change SMTP in php.ini to my ISP's SMTP-server.
In that case the error is the same but instead "localhost" goes "smtp.provider.net". Provider's SMTP works too, and I can send email through it from this machine (that hosts IIS and PHP).

May it be the problem of Win2003 Security or something else?

Could anybody tell me something about this problem?

Thank you very much.

Little more about the problem

Posted: Wed May 25, 2005 11:46 am
by anpal
Furthermore, I've installed sockets extension and tried the following code:

Code: Select all

$s = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
if(socket_connect($s,&quote;localhost&quote;,25))
{
	socket_close($s);
	echo(&quote;socket ok&quote;);
}else
{
	echo(&quote;socket failed&quote;);
}
And this code works well and displays "socket ok".

What could it be in this case?

Posted: Sun May 29, 2005 2:32 am
by mrchiu
Did you set the relay in smtp settings? You have to grant 127.0.0.1 to enable php to have access.