2014-01-07 41 views
0

我已经在互联网上尝试过每一种方式,但不是那些解决了我的问题。我正在使用WAMP 2.2无法连接到“本地主机”端口25的邮件服务器,请验证您的“SMTP”

我使用表单来要求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: [email protected]\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 = "[email protected]"; 
$email_subject = "New Teaching Award Nomination"; 
$email_body = 
"A new teaching award nomination has been submitted by ".$NAME." nominating ".$NOMINEE."."; 
$email_headers = "From: [email protected]\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"); 

但它显示:未能连接到ma ilserver在“nyu.smtp.edu”端口587,验证你的“SMTP”

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

+0

这可能是因为您没有提供任何身份验证凭据。 – thatidiotguy

+0

从问题中编辑出您的个人信息;请不要将它添加回来。 – brandonscript

+0

此外,如果您最终需要使用身份验证(修复SMTP端口后),您需要使用类似[PEAR](http://stackoverflow.com/questions/12166468/sending-html-message-through -pear-while-using-smtp-authentication-returns-an-err) – brandonscript

回答

2

“nyu.smtp.edu”看起来不正确。尝试“smtp.nyu.edu”。您可能会回到使用端口25.

+0

这工作得很好,没有其他安装的邮件服务器!非常感谢哟 – Sio

0

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

相关问题