无法发送给所有收件人 localhost asp.net
尝试通过 ASP.NET 发送电子邮件(服务器上的经典 ASP 工作正常)并收到“无法发送给所有收件人”的消息。错误。邮件服务器设置在本地主机、Windows 2003 服务器 64 位上。
Web Config如下:
<mailSettings>
<smtp from="[email protected]">
<network host="127.0.0.1" port="25" defaultCredentials="true" />
</smtp>
</mailSettings>
生成的代码:
MailMessage mm = new MailMessage();
mm.From = new MailAddress("[email protected]");
mm.To.Add(email);
mm.Bcc.Add("[email protected]");
mm.CC.Add("[email protected]");
mm.Subject = "Your ENGL" + course + "-" + section+ " RaiderWriter account";
mm.Body = sb.ToString();
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Send(mm);
Trying to send email via ASP.NET (classic ASP on the server works fine) and getting the "Unable to send to all recipients." error. Mail server is setup on localhost, Windows 2003 server 64-bit.
Web Config is as follows:
<mailSettings>
<smtp from="[email protected]">
<network host="127.0.0.1" port="25" defaultCredentials="true" />
</smtp>
</mailSettings>
Code that generates:
MailMessage mm = new MailMessage();
mm.From = new MailAddress("[email protected]");
mm.To.Add(email);
mm.Bcc.Add("[email protected]");
mm.CC.Add("[email protected]");
mm.Subject = "Your ENGL" + course + "-" + section+ " RaiderWriter account";
mm.Body = sb.ToString();
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Send(mm);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您的收件人中有多个无效/不存在的电子邮件地址,则某些电子邮件服务器上可能会出现此错误消息,而在我们的电子邮件服务器上,这种情况适用于那些因员工离开公司而不再有效的电子邮件地址。如果您发现任何其他可能的原因,请告诉我。
If you have more than one invalid/non-existent email address in your recipients, this error message might happen on some email server, and on our email server the case applies for those email addresses are no longer valid because the employees left the company. Please let me know if you find any other possible cause.
检查发送邮箱是否已满 - 超过分配的配额。
Check if the sending mailbox is full - over the allocated quota.
如果:
1)用户或通行证错误
2)不启用SSL
3)不启用不太安全的应用程序
4)您尚未使用该邮件登录服务器
that can be if:
1)the user or pass are wrong
2)not enable SSL
3)less secure app is not enable
4)you have not log in in server with this mail
在我们的例子中,原因是 SMTP 服务器拒绝具有特定 IP 地址的机器发送的消息。
SMTP 服务器是 IIS 的一部分,并且配置了允许使用此 SMTP 服务器的 IP 列表。有问题的客户端计算机不在列表中,因此我们得到“无法发送给所有收件人”。 (或德语“Senden an alle Empfänger nicht möglich。”)。
从“有效”客户端发送有效。
在这种情况下,来自 SMTP 服务器的错误消息非常具有误导性。
In our case the reason was that the SMTP-Server refused messages sent by a machine with a specific IP-Address.
SMTP-Server was part of IIS and there was a list of IPs configured which were allowed to use this SMTP-Server. The client machine in question was not part of the list so we got "Unable to send to all recipients." (or "Senden an alle Empfänger nicht möglich." in german).
Sending from a "valid" client worked.
The error message from the SMTP-Server in this case was pretty misleading.
我挣扎了很多,发现我的应用程序池有问题。我设置了 defaultAPPPool 并且我的代码有效。
i struggle a lot and found that there were issue with my Application Pool. I set
defaultAPPPool
and my code worked.