954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Email script not working

<?php


//email(to,subject,message,headers,parameters)

$to="swissknife@gmail.com>";
$subject="Hi";
$message="Hello my friend";
$from="swissknife007@gmail.com";
$headers="from:".$from;
mail($to,$subject,$message,$headers);
echo" mail sent";

?>


This is a very simple php script to send an email.
However ,it is not working for me and I am getting the 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 F:\xampp\htdocs\email1.php on line 10

mail sent

I am using XAMPP for php.
What values should I set the in php.ini ?
Please explain in detail

swissknife007
Junior Poster in Training
74 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
 

You cannot send email with XAMPP using mail(), unless you have a mail server installed. Please search this forum for solutions using PHPMailer.

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Yes first you have to install a SMTP server.There are several free SMTP servers.Do a google search on SMTP servers and you can find further details about this by searching Daniweb previous threads about this.

pro_learner
Junior Poster
113 posts since Dec 2010
Reputation Points: 17
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: