c#根据规则自动处理电子邮件

c#根据规则自动处理电子邮件,c#,rule-engine,email-processing,C#,Rule Engine,Email Processing,我需要一个模式来处理传入的电子邮件 我当前的伪代码如下所示: if sender is a@a.com and messageBody contains "aaa" then extract the content according the aaa function save it to database move the message to the archive else if messageBody contains "bbb" then extract the

我需要一个模式来处理传入的电子邮件

我当前的伪代码如下所示:

if sender is a@a.com and messageBody contains "aaa" then
   extract the content according the aaa function
   save it to database
   move the message to the archive
else if messageBody contains "bbb" then
   extract the content according to bbb function
   save it to database
   inform sender
   move the message to archive
else if messageBody NOT contains "ccc" and from "sender@ccc.com" and then
   leave message in the inbox so the it will be manually processed
else if ...
   ...
因此,我最终得到了一个包含数千行的pig函数

我怎样才能使这件事更简单


提前感谢

解决这一问题需要一个非常好的体系结构,机器学习是解决这类问题的最佳方案之一。但是仍然有一些事情,你可以照顾,为了使它更简单

  • 不要用10个如果来表示10个电子邮件ID,而是创建一个不想要的用户列表(这将成为垃圾邮件)

  • 创建一个不需要的主题列表

  • 创建时间间隔组并相应地处理电子邮件;早上的邮件、中午的邮件、晚上的邮件等

  • 创建有附件检查

  • 无主题检查

  • 无正文检查

  • 朋友电子邮件列表

  • 相同域电子邮件id发件人检查

    谢谢。:)

  • 让它成为db驱动的。创建一个“规则”表,其中包含所有电子邮件的常规属性。给它一个“分数”,该分数根据电子邮件遵守的规则递增。根据分数移动它。