c# - 从代码发送电子邮件时出现“5.7.1 Client does not have permission”错误

标签 c# email exchange-server exchange-server-2010

所以我有一个非常基本的程序试图发送电子邮件,但我一直收到

Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender

这是我的程序

static void Main(string[] args)
{
    SmtpClient client = new SmtpClient("Server", 25);
    client.UseDefaultCredentials = false;
    client.DeliveryMethod = SmtpDeliveryMethod.Network;
    client.Credentials = new NetworkCredential("UserName", "Password");
    client.Send(new MailMessage("kevin@hopethisworks.com","Recipient"));
}

我知道凭据有效,如果我使用相同的数据运行 SMTP 测试工具 3.0,一切都很好。

enter image description here

这是在交换服务器上为我的 IP 设置的接收连接器的一些屏幕截图

enter image description here

enter image description here

有人知道什么会导致我的代码中出现此错误,但不是在简单的 SMTP 测试工具中吗?我在某处缺少某种身份验证选项吗?我已经四次检查了两个地方的所有信息是否正确且相同,它在工具中有效,但在代码中无效。

最佳答案

我发现了问题,我需要为经过身份验证的用户选中“接受任何发件人”框。

enter image description here

更多信息在这里:http://technet.microsoft.com/en-us/library/aa997170(EXCHG.140).aspx

关于c# - 从代码发送电子邮件时出现“5.7.1 Client does not have permission”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12081159/

相关文章:

c# - 页面上的 GridView 不会刷新,即使再次调用 DataBind

c# - 如何解决 ASP.NET C# 中的类型转换错误?

java - 从哪里可以获得 EWS JAVA API 2.0?

c# - 将两个 dd/mm/yyyy 字符串数组合并为一个,同时按顺序排列日期 asp.net c#

vba - 使用 VBA 从 Excel 工作表发送多个附件

html - 直接从 django-template 发送电子邮件

html - CSS 按钮不会在电子邮件模板中呈现

exchange-server - 识别退回的 EmailMessage (EWS)

exchange-server - 更新约会会导致其更改为 EWS 1.1 中的 session

c# - Entity Framework 默认日期时间注释不迁移