Python 发送带有附件的邮件
发布时间:2025-09-01 01:46:52
作者:益华网络
来源:undefined
浏览量(0)
点赞(0)
摘要:Python 发送带有附件的邮件条件 使用from django.core.mail import EmailMessage引入EmailMessage类 示例代码 from django.core.mail importEmailMessage msg =EmailMessage(Subject of the Email,Body of the email,from@email.com,[to@e
Python 发送带有附件的邮件
条件
使用from django.core.mail import EmailMessage引入EmailMessage类示例代码
from django.core.mail importEmailMessage msg =EmailMessage(Subject of the Email,Body of the email,from@email.com,[to@email.com]) msg.content_subtype ="html" msg.attach_file(pdfs/Instructions.pdf) msg.send()原理:
普通的send_mail()方法是EmailMessage类的一种简单的封装,实现简单的发送邮件功能,但是如果要实现复杂的功能,还得使用EmailMessage这个类,具体示例如上。
扫一扫,关注我们
声明:本文由【益华网络】编辑上传发布,转载此文章须经作者同意,并请附上出处【益华网络】及本页链接。如内容、图片有任何版权问题,请联系我们进行处理。
0