On Windows installations, you need to setup PHP to connect to a SMTP server in php.ini. Here's what PHP says about it:

Note: The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine).
Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP.
As such, the to parameter should not be an address in the form of "Something <someone@example.com>". The mail command may not parse this properly while talking with the MTA.

http://php.net/manual/en/function.mail.php

Alternatively you could also use a module like SMTP, which bypasses PHP's mail function:

http://drupal.org/project/smtp

Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net

On 4/7/2010 6:26 AM, John Mitchell wrote:
I get the below error when I initially set up drupal and whenever it
tries to send an email:

    * warning: mail(): Failed to connect to mailserver at "localhost"
port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use
ini_set() in C:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\drupal\includes\mail.inc on line 193.
    * Unable to send e-mail. Please contact the site administrator if
the problem persists.
    * warning: mail(): Failed to connect to mailserver at "localhost"
port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use
ini_set() in C:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\drupal\includes\mail.inc on line 193.
    * Unable to send e-mail. Please contact the site administrator if
the problem persists.

How do I fix this?

Thanks,

John