Jump to content


This topic is now archived and is closed to further replies.


How to get SMTP working on PHP 5 in windows xp

Recommended Posts

I installed PHP 5 on my windows xp successuly.  However, when I try to send out mail with the mail(), I recieve the following error:

[quote]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()[/quote]

My mail settings in my php.ini file is configured like this:
[quote][mail function]
; For Win32 only.
SMTP = localhost     

; for Win32 only
smtp_port = 25     

; For Win32 only.
sendmail_from = me@localhost.com[/quote]

Someone advise me to test if I can connect to telnet localhost 25  --  the connection failed. I am not sure what that indicates.

I tried to shut off the windows firewall and then try to use the mail(), but it still did not work.

If someone can please tell me how to get SMTP working?

Share this post

Link to post
Share on other sites
You need to use an SMTP server in order for emails to be sent, Windows doesnt have an SMTP server installed so you cant send emails. I use my ISPs SMTP server for testing my scripts when using the mail function. See if you can use your ISPs SMTP server.
In order to setup PHP to use an SMTP server you to change [b]SMTP = localhost[/b] to [b]SMTP = SMTPAddress[/b]
The SMTPAddress is usually something like this  smtp.hostname.com

NOTE: You cant use SMTP servers that require authentication in order emails to be sent.

If you dont know any SMTP servers then there is a free SMTP Server software out there but I dont knwo the name of it.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.