【发布时间】:2014-01-08 04:31:35
【问题描述】:
我已经尝试了互联网上的每一种方法,但没有一种方法能解决我的问题。我正在使用 WAMP 2.2
我正在使用一个表格来要求纽约大学学生的电子邮件,当学生提交表格时,它将发送到另一个 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”
我不知道该怎么办!!请帮忙
【问题讨论】:
-
这可能是因为您没有提供任何身份验证凭据。
-
从问题中删除了您的个人信息;请不要重新添加。
-
另外,如果您最终需要使用身份验证(在修复 SMTP 端口之后),您将需要使用类似PEAR
-
如果您想拥有符合 RFC 的邮件,请考虑使用 PHP 邮件程序类 SwiftMailer:swiftmailer.org。它易于使用、面向对象并提供您需要的所有功能。