Check with your isp to see if they block smtp traffic. Most of the tme they require you to use there smtp in an effort to thwart spammers Thank You Chuck Reeves www.manchuck.com On Thu, Feb 3, 2011 at 12:13 AM, Niel Archer <not@xxxxxxxxxx> wrote: > > Hi, > > > > I am trying to send mail from my localhost but i am getting the below > > error > > ""Warning: mail() [function.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 F:\test\xampp\htdocs\sendmail.php on line 42'" > > > > I am using xampp server. Can anyone please tell me what is the error > > > Only Server versions have an MTA available, so if you are using XP, > Vista, or 7; for example, then there is no MTA listening on localhost, > hence the error. > > See the documentation for mail(), in particular the notes for Windows > specifics, at: > http://www.php.net/manual/en/function.mail.php > > However, this is only relevant as your .ini settings seem to be ignored. > Make sure this is in fact the ini file being used. use phpinfo() and > check the used ini path is the same as the one you think should be used. > > > My "php.ini" code is > > [mail function] > > ; For Win32 only. > > ; http://php.net/smtp > > SMTP = smtp.gmail.com > > ; http://php.net/smtp-port > > smtp_port = 587 > > I'm not sure, but I think you may be barking up the wrong tree here. I > don't know how you can use mail() to authenticate with gmail's smtp > server over TLS, as mail() does not have parameters for username and > password. You might be better trying the PEAR::Mail package > > > > ; For Win32 only. > > ; http://php.net/sendmail-from > > ;sendmail_from = xxxxxxxx@xxxxxxxxx > > > > ; For Unix only. You may supply arguments as well (default: > > "sendmail -t -i"). > > ; http://php.net/sendmail-path > > ;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t" > > > > ; Force the addition of the specified parameters to be passed as > > extra parameters > > ; to the sendmail binary. These parameters will always replace the value > of > > ; the 5th parameter to mail(), even in safe mode. > > ;mail.force_extra_parameters = > > > > ; Add X-PHP-Originating-Script: that will include > > uid of the script followed by the filename > > mail.add_x_header = Off > > > > ; Log all mail() calls including the full path of the script, line > > #, to address and headers > > ;mail.log = "F:\test\xampp\apache\logs\php_mail.log" > > -- > Niel Archer > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >