简体   繁体   English

命令通过Poplib模块在Python中发送消息?

[英]commands to send messages in Python via the Poplib module?

I've found a number of tutorials online involving downloading messages via Poplib, but haven't been able to find anything explaining how to create new messages. 我在网上找到了许多教程,这些教程涉及通过Poplib下载消息,但是找不到任何解释如何创建新消息的内容。 Does this exist? 是否存在?

As S.Lott rightly says, you will want some smtp, but to create the actual email, use the email package from the standard library, then use an message's as_string method to send it. 正如S.Lott正确说的那样,您需要一些smtp,但是要创建实际的电子邮件,请使用标准库中的电子邮件包,然后使用消息的as_string方法发送它。

An example with multipart MIME (how cool is that!) 多部分MIME的示例(这太酷了!)

Send yourself an email to create a message. 给自己发送电子邮件以创建消息。

SMTP is the protocol the email uses to send. SMTP是电子邮件用来发送的协议。 In Python, you'd find this in smtplib . 在Python中,您可以在smtplib中找到它。

There are numerous email RFC's. 有许多电子邮件RFC。 Here are a few. 这里有一些。

SMTP - RFC 821 SMTP- RFC 821

POP - RFC 1939 POP- RFC 1939

IMAP - RFC 1730 IMAP- RFC 1730

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM