System.Net.Mail.SmtpFailedRecipientException:邮箱名称不允许 [英] System.Net.Mail.SmtpFailedRecipientException: Mailbox name not allowed

查看:710
本文介绍了System.Net.Mail.SmtpFailedRecipientException:邮箱名称不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写ASP.Net code从domain1.com电子邮件帐户发送邮件,如abc@domain1.com。这code做工精细,否则和邮件去。但是,当同一code执行上domain2.com,即使有正确的用户ID-PWD它提供了以下错误:

I have written ASP.Net code to send mails from domain1.com mail account such as abc@domain1.com. This code work fine otherwise and the mails go. But when the same code executes on domain2.com, even with correct userid-pwd it gives the following error:

System.Net.Mail.SmtpFailedRecipientException:邮箱名称不允许的。服务器响应为:对不起,该域不在我的允许System.Net.Mail.SmtpClient.Send的rcpthosts(#5.7.1)的列表(消息MAILMESSAGE)

System.Net.Mail.SmtpFailedRecipientException: Mailbox name not allowed. The server response was: sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) at System.Net.Mail.SmtpClient.Send(MailMessage message)

有什么办法解决这一问题?

Is there any way to fix this?

如果我们要在允许的rcphosts列表中添加这一领域,这怎么办呢?

If we have to add this domain in the list of allowed rcphosts, how can that be done?

编写的code是这样的:

The code written is something like this:

MailMessage message;
bool success;
message = new MailMessage(from, to);
Attachment file;
SmtpClient lclient;


lclient = new SmtpClient("mail.domain1.com", 587);
lclient.EnableSsl = false;

message.Body = body;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
message.Subject = subject;
message.SubjectEncoding = System.Text.Encoding.UTF8;

lclient.SendCompleted += new 
SendCompletedEventHandler(SendCompletedCallback);
lclient.UseDefaultCredentials = false;
lclient.Credentials = new NetworkCredential(userID, password);
try
{

  lclient.Send(message);
  success = true;
  if (message != null)
      message.Dispose();
  success = true;
  return (success);
}
catch (Exception ex)
{  
    //...
}

感谢

推荐答案

在code正常工作。该错误是SMTP服务器的拒绝。这似乎是在服务器上,从域1访问时,允许你通过它转发邮件。当来自域2访问,事实并非如此。改变这将是SMTP服务器上的配置。

The code works fine. The error is a rejection from the SMTP server. It would seem that the server, when accessed from Domain1, allows you to forward mail through it. When accessed from Domain2, it does not. Changing this would be a configuration on the SMTP server.

请注意,这是对SMTP服务的通行做法。他们一般不允许任何人通过他们发送邮件到任何地址。 (这将让他们敞开垃圾邮件和其他不需要这样的活动。)所以,如果你想从域1的外部访问域1的SMTP服务,它可能只是拒绝了。

Note that this is common practice for SMTP services. They generally don't allow anybody to send mail through them to any address. (That would leave them wide open for spammers and other such unwanted activities.) So, if you're trying to access Domain1's SMTP service from outside of Domain1, it's probably just rejecting that.

这篇关于System.Net.Mail.SmtpFailedRecipientException:邮箱名称不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆