Click here to Skip to main content
16,017,922 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:\wamp\www\new.php on line 3

is the error while sending mail.plz help?
I have searched on google but i am not able to get proper answer.plz help
what changes should done in php.ini?plz explain
Posted
Updated 9-Jan-12 22:28pm
v3
Comments
Sergey Alexandrovich Kryukov 10-Jan-12 1:25am    
Look all right, from the first glance. How do you know that mail is properly configured in you host system?
--SA
Graham Breach 10-Jan-12 4:18am    
You're suppressing errors by putting '@' in front of mail(... - take that out and you might be able to see what the problem is.

Can you post the section [mail function] from php.ini file?

See:
http://www.php.net/manual/en/mail.configuration.php[^] and http://www.w3schools.com/php/php_ref_mail.asp[^]

Hope it helps.
 
Share this answer
 
To send mail in php using wamp:
first download sendmail.exe through this link.
open sendmail (configration file)make following changes in it(if u use gmail)then,
smtp_server=smtp.gmail.com
auth_username=yourmailaddress@gmail.com
auth_password=yourpassword
pop3_server=
pop3_username=yourmailaddress@gmail.com
pop3_password=yourpassword
force_sender=yourmailaddress@gmail.com
now save it.
open php.ini file
NOTE:if you are using wampserver then click on the icon of the wampserver and u will find the php.ini file.open it and find SMTP word in it and make following changes in it,

smtp= smtp.gmail.com
smtp_port = 465
smtp_ssl=auto
sendmail_from = astikajadhav@gmail.com
sendmail_path = "C:\wamp\sendmail.exe -t"
sendmail_path = "C:\wamp\sendmail.exe"(this is the path of the send mail.exe if you stored it on the other path then give that path).
save and close php.ini file.Restart server.
now u can try.
If u got any error then you have done some mistake in above process.again do the same procedure.(It is tested fully).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900