Python:smtpd(或替代方案)用于生产邮件接收?

发布于 2024-07-09 03:13:14 字数 402 浏览 5 评论 0 原文

我正在寻找对电子邮件进行各种处理 - 例如。 检查标头,如果它们满足某些条件(看起来像垃圾邮件),则断开连接,或检查收件人列表并执行特殊过滤。

看起来Python的smtpd库提供了一个漂亮而简单的接口来处理收到的电子邮件。

要在完全处理消息之前对其进行处理(例如,在标头看起来像垃圾邮件的情况下删除消息),我应该使用handle_connect吗? 内部 API(process_message 除外)是否记录在某处? 示例代码在哪里?

另外,有人在生产中使用过 smtpd 吗? 关于可靠性等有什么想法吗?

关于 Twisted:我曾多次尝试采用 Twisted,并且非常喜欢延迟模型,但对于我目前的口味来说,它有点太复杂了。 我会再看一下,但现在我对非 Twisted 实现更感兴趣。

I'm looking to do various processing of email - eg. inspect the headers, and if they meet some criteria (look like spam), drop the connection, or inspect the recipient list and perform special filtering.

Looks like Python's smtpd library provides a nice and simple interface for processing the received email.

To deal with the message before it's fully processed (eg. to drop the message in case the headers look like spam), should I be using handle_connect? Are the internal APIs (other than process_message) documented somewhere? Example code anywhere?

Also, has anyone used smtpd in production? Any thoughts on reliability, etc?

Regarding Twisted: I've attempted to embrace Twisted several times and quite like the deferred model, but it's a bit too complex for my current taste. I'll give it another look, but for now I'm more interested in non-Twisted implementations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

下雨或天晴 2024-07-16 03:13:14

您可能需要查看 twisted 实现,因为这将使您能够与客户端进行全方位的交互。 我相信(尽管我从未在生产中使用过它)twisted 在生产环境中是值得信赖的。

You may want to look at the twisted implementation as that will give you access to the full range of interaction with the client. I believe (though I have never used it in production) that twisted can be trusted in a production environment.

榕城若虚 2024-07-16 03:13:14

另一种方法:使用 Postfix 接收电子邮件并编写 策略 Python 脚本。

Another approach: use Postfix for receiving email and write a policy script in Python.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文