tags:

views:

42

answers:

2

I have encounter an 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 C:\works\test\registration-code3.php on line 56

any help?

here is my php.ini

define_syslog_variables  = Off

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = postmaster@localhost
A: 

It looks like, your windows machine don't have SMTP server on the port 25. I am guessing that it is your development machine? instead editing your ini file you can try some other SMPT servers for instance the one your ISP provided you with.

Try to add the following code to the top of email script;

ini_set("SMTP","mail.domain.com");

ini_set("smtp_port","25");

ini_set('sendmail_from', '[email protected]');

aromawebdesign.com
still having problem.. :(
devzone
+1  A: 

Based on what you've shown us, particularly this bit:

C:\works\test\registration-code3.php

Leads me to believe your testing some script on your local system. If this is so and you haven't installed and set up a mail server, then of course its not going to work. You require a MTA to actually send the email, PHP just hands off to it.

If you've simply installed XAMPP then you don't have a working MTA to send through without some real work ahead of you.

If you must send email from your dev machine in this fashion, I recommend picking and using a script like Swiftmailer which will allow you to easily use a mail server hosted elsewhere - like your ISP or even google.

Erik