1. 首页
  2. 其他

建立一个电子邮件客户端有多难?- Python

本文介绍了建立一个电子邮件客户端有多难?- Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在这里冒险未知的领域……

我正在尝试计算使用 Python 实现电子邮件客户端的难度:

  • 邮件检索
  • 电子邮件发送
  • 电子邮件格式
  • 电子邮件呈现

我还想知道是否所有协议都易于/难以支持,例如SMTP、IMAP、POP3、…

<小时>

希望有人能指出我正确的方向:)

解决方案

Python 语言确实在其标准库中提供了对所需协议的原始支持.正确使用 then,并正确解析和组装现代”电子邮件,但是可能很难做到.

另外,你没有说你是否想为你的电子邮件客户端创建一个图形界面——如果你想有一个合适的图形界面——直到可用的程度,它是相当多的工作.

本地电子邮件存储将是更容易的部分 – 除非您想正确实现 mbox 文件格式 RFC-4155 以便其他软件可以轻松读取/写入您获取的消息,您可以使用 ORM 或面向对象的数据库(如 ZODB 或 MongoDB)将它们存储为 Python 对象.p>

如果您想要的不仅仅是一个玩具电子邮件应用程序,您将有很多工作 – 正确编码电子邮件标头,例如,服务器身份验证和安全身份验证和传输层,电子邮件文本正文的解码本身用于非 ASCII 消息.尽管 Python 标准库中的模块确实实现了很多,但它们的文档缺少示例 – 并且一个完整的电子邮件客户端必须使用所有这些.

当然,启动电子邮件客户端(即使是玩具客户端)的地方是查看最新的电子邮件 RFC(然后您必须从这里选择 http://www.ietf.org/rfc/rfc-index 因为只是在寻找email rfc”google 给出的结果很差).

I’m venturing in unknown territory here…

I am trying to work out how hard it could be to implement an Email client using Python:

  • Email retrieval
  • Email sending
  • Email formatting
  • Email rendering

Also I’m wondering if all protocols are easy/hard to support e.g. SMTP, IMAP, POP3, …


Hopefully someone could point me in the right direction 🙂

解决方案

The Python language does offer raw support for the needed protocols in its standard library. Properly using then, and, properly parsing and assembling a “modern day” e-mail message, however can be tough to do.

Also, you didn’t say if you want to create a graphical interface for your e-mail client — if you want to have a proper graphical interface — up to the point of being usable, it is quite a lot of work.

Local e-mail storage would be the easier part – unless you want to properly implement an mbox file format RFC-4155 so that other software can easily read/write the messgaes you have fetched, you can store them in as Python Objects using an ORM or an Object Oriented database, such as ZODB, or MongoDB.

If you want more than a toy e-mail app, you will have a lot of work – properly encoding e-mail headers, for example, server authentication and secure authentication and transport layers, decoding of the e-mail text body itself for non ASCII messages. Although the modules on the Python standard library do implement a lot of that, their documentation falls short on examples – and a complete e-mail client would have to use all of then.

Certainly the place to start an e-mail client, even a toy one, would be taking a look on the most recent RFC’s for e-mail (and you will have to pick then from here http://www.ietf.org/rfc/rfc-index since just looking for “email rfc” on google gives a poor result).

这篇关于建立一个电子邮件客户端有多难?- Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,WP2

建立一个电子邮件客户端有多难?- Python 为WP2原创文章,链接:https://www.wp2.cn/other/%e5%bb%ba%e7%ab%8b%e4%b8%80%e4%b8%aa%e7%94%b5%e5%ad%90%e9%82%ae%e4%bb%b6%e5%ae%a2%e6%88%b7%e7%ab%af%e6%9c%89%e5%a4%9a%e9%9a%be-python/