是否有 rfc822.AddressList 的未弃用等效项?

发布于 2024-09-30 05:47:32 字数 137 浏览 0 评论 0原文

我需要像 rfc822.AddressList 这样的东西来将电子邮件的“TO”标头字段的内容解析为单独的地址。由于 rfc822 已被弃用,取而代之的是电子邮件包,我在那里寻找类似的东西,但找不到任何东西。有谁知道我应该用什么来代替?

谢谢!

I need something like rfc822.AddressList to parse, say, the content of the "TO" header field of an email into individual addresses. Since rfc822 is deprecated in favor of the email package, I looked for something similar there but couldn't find anything. Does anyone know what I'm supposed to use instead?

Thanks!

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

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

发布评论

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

评论(2

红焚 2024-10-07 05:47:32

哦,这是 email.utils.getaddresses。只需确保使用列表来调用它即可。

Oh it's email.utils.getaddresses. Just make sure to call it with a list.

温馨耳语 2024-10-07 05:47:32

如果您愿意使用第三方模块,我将 Python 2.x 模块 rfc822 移植到 Python 3.x

https ://github.com/MarkNenadov/rfc822py3

尚未经过彻底测试。我鼓励您尝试一下,并让我知道它是如何工作的以及您是否遇到任何问题。

为了让你的代码在 Python 2 和 3 中都能工作,你可以使用我的 rfc822py3 模块并执行以下操作:

try:
   import rfc822
except ImportError:
   import rfc822py3 as rfc822

If you are open to using a third party module, I ported the Python 2.x module rfc822 to Python 3.x

https://github.com/MarkNenadov/rfc822py3

It hasn't been tested thoroughly yet. I encourage you to try it out and let me know how it works and whether you have any problems.

To make your code work in both Python 2 and 3 you can take my rfc822py3 module and do:

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