无法连接到“localhost”端口25上的邮件服务器,验证您的“SMTP”

时间:2014-01-07 20:17:38

标签: php email

我已尝试过互联网上的每一种方式,但没有解决我的问题。我正在使用WAMP 2.2

我正在使用表格要求nyu学生电子邮件,当学生提交表格时,它会发送到另一个nyu.edu电子邮件并收到确认。

原始代码:

// send the notification email
$mailto =  $EMAIL;//requied from the form
$subject = "Thank you for your nomination!";
$body = 
"Dear ".$NAME.",

This confirms that we have received your nomination of ".$NOMINEE." for a teaching award. Thank you for your submission.

NYU Teaching Awards Team";
$headers = "From: somemail@example.com\n\n";
if (mail($mailto, $subject, $body, $headers)) {
    echo("<p>Message successfully sent!</p>");
} else {
    echo("<p>Message delivery failed...</p>");
}
//end notification email


// send the notification email
$mail_to =  "somemail@example.com";
$email_subject = "New Teaching Award Nomination";
$email_body = 
"A new teaching award nomination has been submitted by ".$NAME." nominating ".$NOMINEE.".";
$email_headers = "From: somemail@example.com\n\n";
if (mail($mail_to, $email_subject, $email_body, $email_headers)) {
    echo("<p>Message successfully sent!</p>");
} else {
    echo("<p>Message delivery failed...</p>");
}
//end notification email

错误消息无法连接到“localhost”端口25的邮件服务器,验证您的“SMTP”

所以我就把它绑起来了

ini_set("SMTP","nyu.smtp.edu");
ini_set("smtp_port","587");

但它显示:无法连接到“nyu.smtp.edu”端口587的邮件服务器,验证您的“SMTP”

我不知道该怎么办!!请帮忙

2 个答案:

答案 0 :(得分:2)

&#34; nyu.smtp.edu&#34;看起来不对。试试&#34; smtp.nyu.edu&#34;。您可以回到使用端口25。

答案 1 :(得分:0)

确保您的服务器上安装了sendmail。 但是如果你想要更多选择发送邮件,你必须考虑PEAR。