不要发送主题重复的邮件
我们有不同的流程,可以在遇到问题时发送邮件(例如没有足够的权限对特定订单项执行操作)。这种方法效果很好,有时每 5 分钟就会发送一次相同的消息。在我们的环境中,在应用程序层上同步发送电子邮件是非常困难的(实际上有不同的应用程序发送电子邮件,因此如果我们要在应用程序层内部实现此功能,我们就必须接触每个应用程序)。
对我来说,过滤邮件(按重复主题)最好在电子邮件层内完成,例如接收 SMTP 请求的应用程序,这似乎是合乎逻辑的。
然而,我们也不希望自己深入到 SMTP 层,而是使用现有的服务/应用程序。
有人知道网络邮件程序(如谷歌邮件)可以进行这种过滤吗?对我们来说,为这样的服务付费是可以接受的,所以“像啤酒一样免费”会很好,但不免费也不是问题。
提前致谢 霍尔格
we've got different processes that send mails in case of issues encountered (e.g. not enough permissions to perform an operation on a certain order item). This works fine to the point that sometimes identical messages are sent every 5 minutes. In our environment it is very difficult to synchronize the email sending on application layer (actually there are different applications sending out email, so we'd have to touch every application if we were to implement this inside application layer).
It would seem logical for me that filtering out mails (by duplicate subjects) is best done within the email layer, e.g. the application receiving the SMTP requests.
Yet we'd also prefer not to go down to SMTP layer by ourselves, rather use an existing service/application.
Is anybody aware of a web mailer (like googlemail) which does this kind of filtering? it would be ok for us the pay for such a service, so being "free as in beer" would be nice, but being not free is not a showstopper.
Thanks in advance
Holger
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现通过
Subject:
标头过滤重复电子邮件的想法非常令人担忧。如果它们是由多个应用程序生成的,您如何确定消息的内容是重复的,并且您不会无意中丢弃重要通知?消息唯一可用于过滤掉重复项的唯一功能是其
Message-ID:
标头。如果两条消息的标头相同,则通常可以合理地假设它们是同一原始消息的副本 - 例如,一条是直接收到的,另一条是抄送给邮件列表的。也就是说,您可以在大多数 SMTP 服务器上做几乎任何您想做的事情 - 至少是那些基于类 Unix 操作系统的服务器。例如,Postfix 可以使用自定义 shell 脚本进行过滤。
例如,您可以使用 formail 提取每条消息的正文并生成其
MD5 哈希值。将消息正文哈希值与
Date:
、Subject:
、From:
、To:
和进行比较同时使用 >Cc:
标头是检测真正重复项的良好开端。I find the idea of filtering duplicate e-mail message by the
Subject:
header quite worrisome. If they are produced by multiple applications, how can you be certain that the content of the messages is duplicated and that you are not unwittingly dropping important notifications?The only unique feature of a message that can be used to filter out duplicates is its
Message-ID:
header. If that header is the same for two messages, then it's usually reasonable to assume that they are copies of the same original message - e.g. one received directly and one that was CC'ed to a mailing list.That said, you can do pretty much anything you want on most SMTP servers - at least those that are based on a Unix-like OS. For example, Postfix can use custom shell scripts for filtering.
You can, for example, use formail to extract the body of each message and produce its
MD5 hash. Comparing the message body hashes along with the
Date:
,Subject:
,From:
,To:
andCc:
headers at the same time is a good start to detect real duplicates.