I'm trying to send mail out from an external smtp server using a php script below,
<?php
$recipient="john_doe@gmail.com";
$subject="Website to customer";
$message="Customer Name: ".$_POST['name']."\r\n";
$message.="Customer Email: ".$_POST['email']."\r\n";
$message.="Customer Message: ".$_POST['msg']."\r\n";
$mailheader="From: <maria@comcast.net> \r\n";
$mailheader.="Reply to ".$_POST['email'];
ini_set("SMTP","comcast.net");
mail($recipient, $subject, $message, $mailheader);
?>
<!DOCTYPE html>
<html>
<head>
<title>Sending mail from website to Customer</title>
</head>
<body>
<p>Thanks, <strong><?php echo $_POST['name']; ?></strong>, for your message.</p>
<p>Your email address: <strong><?php echo $_POST['email']; ?></strong></p>
<p>Your message: <br/><?php echo $_POST['msg']; ?></p>
</body>
<html>
I got an error message:
Warning: mail() [function.mail]: Failed to connect to mailserver at "comcast.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\sendmail.php on line 10
Is that because I don't have a local email server? Will phpmailer solve my problem? Can anyone guide me to the right direction please? Thanks a lot.