Debugging can be hectic sometimes… How do I deal with the mail function? It seems I need to change some settings but I have not idea on how I can handle them: when I try to post a reply on my forum this error is popping up:
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\mysite\forum part two\post_reply_parse.php on line 72
my code on line 72 is this
mail($to, $subject, $message, $headers);
my mail code is like this
$email = '';
$email = substr($email, 0, (strlen($email) - 2));
address with your domain at the end
$to = "";
$from = "";
// $bcc is the list of emails that will be sent out as blind carbon copies
$bcc = $email;
$subject = "YOUR_SUBJECT_HERE";
$message = "YOU MESSAGE CONTENT HERE";
$headers = "From: $from\r\nReply-To: $from";
$headers .= "\r\nBcc: {$bcc}";
// Send out the email
mail($to, $subject, $message, $headers);
I do not want to ignore this error and I would love to learn how I can fix it.
PHP will use
sendmailon a Linux/Unix machine by default, as it is a generally available mailer service.Windows, on the other hand, does not come packaged with one. In order to use
mail()on a Windows machine, you need to install a local SMTP server or configure your PHP installation to relay messages through another SMTP server.Note: I haven’t personally used any as I tend to do development on Linux/Unix machines, but this might work for you: http://www.hmailserver.com/