Click here to Skip to main content
15,902,114 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!!



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



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

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
 
Comments
Trick7 12-Sep-11 13:47pm    
I donot know how to set it, as i am new to php. Please give me detailed answer?
Thanks!!
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
If you are using Windows and not using a mail server program you can't use mail function :)
 
Share this answer
 
Comments
Trick7 12-Sep-11 14:51pm    
I donot have any mail server, I am using windows. It means i cant create this this??
????? Please help

I donot have mail server but want to run through Windows. Is there any other method?
 
Share this answer
 
Install Xamp -> it comes with mercury and the required setting :)
 
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