By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

Mail Function

P: 8
Hi all. i need help from u. i use the mail function, but error displays. how to rectify. please help
the coding is

<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com";
mail($to,$subject,$txt,$headers);
?>

the error is

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:\Program Files\xampp\htdocs\textexample\mailfn.php on line 6
Feb 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: 15
Your php code is correct,
you are not allowed to send mail because you need to configure your php.ini file with SMTP function and port.
Feb 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.