View Full Version : PHP Mail function in Windows 2003 Server

Gary Williams
06-30-2010, 01:05 PM
Hi All,

I have PHP 5 installed on a Windows 2003 SP2 server.
I can't send any emails.

I have tried this simple test script:

$to = "gary@internetpipelinesuk.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "gary@internetpipelinesuk.com";
$headers = "From: $from";
echo "Mail Sent.";

but all I get is "Web page cannot be displayed".

sendmail is enabled in php.ini

Is there a list of tests I can run to identify this problem and fix it?



06-30-2010, 04:27 PM
It's probably fair to say that W2K3 does not have sendmail, being that it's windows. I'm not sure if it uses the sendmail calls to invoke the Windows SMTP 'connector'/'process' but I *think* you need to configure an account that can send mail via SMTP on the box, and use those credentials in the php.ini file (from memory a long time ago - so busking it a bit). Is the 2k3 server running Exchange and acting as a DC at all, or just a stand alone server?

The troubleshooting would probably begin with setting up the SMTP service (if you are not using exchange) and making sure you can sent out with it using some simple telnet or client tests to it. Get that working then try and get PHP talking to it.

Post 13 at this link may help:

06-30-2010, 04:56 PM
The error "Web page cannot be displayed" suggests the issue is beyond not sending mail. It's not loading the page at all. Do any PHP pages load?