我正在尝试使用下面的 php 脚本从外部 smtp 服务器发送邮件,
<?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>
我收到一条错误消息:
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
那是因为我没有本地电子邮件服务器吗?phpmailer会解决我的问题吗?任何人都可以指导我正确的方向吗?非常感谢。