Php 无法连接到位于“的邮件服务器”;“本地主机”;端口25,验证您的;SMTP";

Php 无法连接到位于“的邮件服务器”;“本地主机”;端口25,验证您的;SMTP";,php,email,Php,Email,我在互联网上尝试过每一种方法,但没有一种能解决我的问题。我正在使用WAMP 2.2 我正在使用表格要求纽约大学学生发送电子邮件,当学生提交表格时,它将发送到另一封纽约大学教育部电子邮件并收到确认 原始代码: // send the notification email $mailto = $EMAIL;//requied from the form $subject = "Thank you for your nomination!"; $body = "Dear ".$NAME.", T

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

我正在使用表格要求纽约大学学生发送电子邮件,当学生提交表格时,它将发送到另一封纽约大学教育部电子邮件并收到确认

原始代码:

// 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
但它显示:无法在“nyu.smtp.edu”端口587连接到邮件服务器,请验证您的“smtp”


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

“nyu.smtp.edu”看起来不对。试试“smtp.nyu.edu”。您可以重新使用端口25。

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

这可能是因为你没有提供任何认证凭据。如果你最终需要使用身份验证(在修复SMTP端口之后),你需要使用一些类似的东西,比如如果你想拥有RFC兼容邮件,考虑使用PHP MauleCype SWIFTMAL:它易于使用,面向对象,并提供您所需的所有功能。这非常好用,没有其他安装邮件服务器!!非常感谢
ini_set("SMTP","nyu.smtp.edu");
ini_set("smtp_port","587");