Click here to Skip to main content
15,902,884 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:\wamp\www\Login\insert.php on line 101

I am using the following code!!

$sendto = $_POST['email']; // this is the email address collected form the form
$ccto = ""; //you can cc it to yourself
$subject = "email confirmation"; // Subject
$message = "the body of the email - this email is to confirm etc..."
$header = "From:\r\n";
$header .= "Reply-to:\r\n";
// This is the function to send the email
mail($sendto, $subject, $message, $header);      // line no... 101

Please Help!!
Updated 12-Sep-11 7:31am

Install Xamp -> it comes with mercury and the required setting :)
Share this answer
????? Please help

I donot have mail server but want to run through Windows. Is there any other method?
Share this answer
If you are using Windows and not using a mail server program you can't use mail function :)
Share this answer
Trick7 12-Sep-11 14:51pm    
I donot have any mail server, I am using windows. It means i cant create this this??
As the error message says you need to configure your Mail server in php.ini configuration file. Or you can set it in this file as well using ini_set()

hope it helps :)

for further queries comment here!
Share this answer
Trick7 12-Sep-11 13:47pm    
I donot know how to set it, as i am new to php. Please give me detailed answer?
Uday P.Singh 12-Sep-11 14:09pm    
Do you have any mail server?
Trick7 12-Sep-11 14:52pm    
No i donot have a mail server..
Uday P.Singh 12-Sep-11 15:21pm    
then you can't send mail using mail method!
Trick7 12-Sep-11 15:45pm    
can u please tell how to proceed the confirmation with mail... please?? help

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