- Code: Select all
<?php $to = "altest2@localhost"; $subject = "Contact Us"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?>
I'm trying to use this to send information entered on a form to [url]altest2@localhost[/url].
However, I keep getting 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() in C:\xampp\htdocs\formtest\contact.php on line 1
We encountered an error sending your mail
I'm new to XAMPP and PHP so any help would be greatly appreciated