简体   繁体   English

Exchange路由代理检测电子邮件方向

[英]Exchange Routing Agent Detect Email Direction

We have an Exchange Trasport Agent, which is specifically a RoutingAgent. 我们有一个Exchange Trasport代理,它专门是一个RoutingAgent。 In the OnSubmittedMessage event we need to inspect the MailItem and determine if it is outbound or inbound. OnSubmittedMessage事件中,我们需要检查MailItem并确定它是出站还是入站。 I am currently looking at using the SmtpServer.AcceptedDomains property to check if the sender email is in the accepted domains list. 我目前正在使用SmtpServer.AcceptedDomains属性检查发件人电子邮件是否在“接受的域”列表中。 Here is an example of how we are trying to do this: 这是我们尝试执行此操作的示例:

private bool IsOutbound(MailItem mailItem, AcceptedDomainCollection acceptedDomains)
{
    if (acceptedDomains.Find(mailItem.FromAddress) != null)
    {
        return true;
    }
    return false;
}

I am not extremely familiar with Accepted Domains, and I am trying to understand if this is a viable solution to reliably determine the direction of an email? 我对“接受域”不是很熟悉,我试图了解这是否是可靠确定电子邮件方向的可行解决方案? This scenario also needs to work for companies that have multiple domains included in their Exchange organization setup. 此方案还需要适用于Exchange组织设置中包含多个域的公司。 Note that we plan to support Exchange 2010-2016 if that makes any difference. 请注意,如果有任何不同,我们计划支持Exchange 2010-2016。

--EDIT-- - 编辑 -

After getting some help from @GlenScales I realize I need to update my question a bit. 从@GlenScales获得一些帮助后,我意识到我需要稍微更新一下我的问题。

My goal is to determine if the sender of the email is in a domain that is internal to the Exchange organization. 我的目标是确定电子邮件的发件人是否在Exchange组织内部的域中。 This could also be achieved by determining if the email was generated within Exchange, we are able to inspect the recipients at a later stage just fine and see if it is inbound or outbound. 这也可以通过确定电子邮件是否是在Exchange中生成的来实现的,我们可以在以后的阶段很好地检查收件人并查看它是入站还是出站。

With that being said, we looked at 3 possible solutions: 话虽如此,我们研究了3种可能的解决方案:

  1. Check the sender domain against the list of Accepted Domains 根据“接受域”列表检查发件人域
  2. Use the AddressBook to check if the sender is internal 使用通讯簿检查发件人是否为内部
  3. Check the InboundDeliveryMethod property and see if it was created from a mailbox 检查InboundDeliveryMethod属性,并查看它是否是从邮箱创建的

In the end we decided that we really wanted to be inspecting messages that were generated from a mailbox only and went with #3. 最后,我们决定我们真的想检查仅从邮箱生成并与#3一起发送的邮件。 #1 sounded like it could potentially include domains that were really just "forwarding" domains, and we do not want to consider those messages in our application. #1听起来似乎可能包含实际上只是“转发”域的域,并且我们不想在应用程序中考虑这些消息。

AcceptedDomains tells you all the SMTP domains that the Exchange Organization will delver for. AcceptedDomains会告诉您Exchange组织将要研究的所有SMTP域。 Eg When the Exchange Transport Server performs message categorization on a Message if the Message is To an Address that is within the Accepted domains it will take responsibility for delivery that message to that recipients (there can be multiple recipients in a message so that point the message maybe forked and delivered to the Internal recipient and the sent on to the external recipient). 例如,如果Exchange传输服务器对邮件进行邮件分类(如果邮件是到接受域内的地址),它将负责将该邮件传递给该收件人(邮件中可以有多个收件人,以便指向该邮件也许分叉并传递给内部收件人,然后发送给外部收件人)。

What your doing just tells you where the Sender is from not really the direction of the Message as such. 您所做的只是告诉您发件人在哪里,而实际上并不是消息的方向。 OnSubmittedMessage means you capturing a Message before any categorization has taken place in the case it's a message that has been sent from within your org but if the message has both internal and external recipients some copies the it will have multiple destinations. OnSubmittedMessage意味着您是在组织内部发送邮件的情况下,在进行任何分类之前捕获邮件的,但是如果该邮件同时具有内部和外部收件人,则该邮件将具有多个目的地。

There also some other options in https://social.msdn.microsoft.com/Forums/en-US/9387e62a-76d7-4340-b9cc-f87ffcfab8b1/how-to-detect-the-message-source-in-an-exchange-server-2013-transport-agent-for-getting-the-sending?forum=exchangesvrdevelopment which I'd suggest you look at https://social.msdn.microsoft.com/Forums/zh-CN/9387e62a-76d7-4340-b9cc-f87ffcfab8b1/how-to-detect-the-message-source-in-an- exchange-server-2013-transport-agent-for-the-send-send?forum = exchangesvrdevelopment ,我建议您看一下

Cheers Glen 干杯格伦

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Exchange路由代理-使用C#检查电子邮件地址是否是Exchange共享邮箱 - Exchange Routing agent - check if email address is a exchange shared mailbox using C# Exchange路由代理-检查电子邮件地址是否为带有C#的Exchange通讯组列表 - Exchange Routing agent - check if email address is an Exchange Distribution List with C# Exchange - 路由代理,用于将电子邮件按摩的接收者从通讯组类型更改为其成员的单个电子邮件地址 - Exchange - routing agent that changes the email massage's recepient from a distribution group type to single email adresses from its members 有关如何运行 PowerShell 脚本以在 Exchange 服务器上创建邮箱的说明 - Direction on how to run PowerShell script to create email box on Exchange server 如何在Exchange C#上检测发送电子邮件失败 - How detect send email failure on Exchange C# 使用Exchange Web服务托管API检测电子邮件移动? - Detect email move using Exchange Web Service Managed API? Microsoft Exchange传输代理 - Microsoft Exchange Transport Agent Exchange 2013传输代理为内部与外部收件人发送单独的电子邮件 - Exchange 2013 Transport Agent Sending Separate Email for Internal Vs External Recipients 交换运输代理。 转发电子邮件,但不传递给收件人 - Exchange Transport Agent. Forward email but don't deliver to addressed recipient Outlook无法显示从Exchange传输代理导出的TNEF电子邮件的正文 - Outlook can't show body of TNEF email exported from Exchange transport agent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM