如何使用 SMTP 发送附件? [英] How do I send attachments using SMTP?

查看:108
本文介绍了如何使用 SMTP 发送附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个使用 Python 的 smtplib 发送电子邮件的程序.我搜索了文档和 RFC,但找不到与附件相关的任何内容.因此,我确定我遗漏了一些更高级别的概念.有人能告诉我附件在 SMTP 中是如何工作的吗?

I want to write a program that sends email using Python's smtplib. I searched through the document and the RFCs, but couldn't find anything related to attachments. Thus, I'm sure there's some higher-level concept I'm missing out on. Can someone clue me in on how attachments work in SMTP?

推荐答案

您要查看的是 email 模块.它让您可以构建 MIME 兼容的消息,然后使用 smtplib 发送.

What you want to check out is the email module. It lets you build MIME-compliant messages that you then send with smtplib.

这篇关于如何使用 SMTP 发送附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆