Click here to Skip to main content
15,883,796 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I am using the mail in php and I get the following error. Can any one please help me in resolving the error:
error message :
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() inD:\xampp\htdocs\rajesh\registrationProcess.php on line 98
Posted
Updated 11-Mar-11 19:50pm
v2

The url to your mailserver appears to be incorrect. Localhost is your system, where as your email server would probably be located somewhere else.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Mar-11 1:10am    
localhost detected! My 5.
--SA
Abhinav S 12-Mar-11 3:14am    
Thanks SA.
If you want to sent mail from local host then XAMPP comes with a mail server called Mercury.

In your XAMPP folder find the folder Mercury open that and open the Mercury.exe.

Then follow this http://www.danieltmurphy.com/setting-up-mercury-smtp/[^]

Open Xampp control panel, check the Mercury SVC checkbox and click start.

Important Point: Though you can send mails from local server. It is not desired. Because

1) Many other receiver mail servers block mails arising from unknown host as a precaution of spamming
2) When you move this to a production server you have to reconfigure everything.

So better advice is use the Mail server available with your expected hosting domain.
 
Share this answer
 
Comments
Abhinav S 12-Mar-11 3:15am    
Good and interesting approach. 5.
Albin Abel 12-Mar-11 3:31am    
Thanks Abhinav

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