maildefinition.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mailprod 作者: shivylp 项目源码 文件源码
def as_mailobj(self):
        # Create the root message and fill in the from, to, and subject headers
        msgRoot = MIMEMultipart('related')
        msgRoot['Subject'] = self.subject
        msgRoot['From'] = self.get_sender()
        msgRoot['To'] = ", ".join(self.recipients)
        msgRoot.preamble = 'Generated by mailprod python tool'
        for i in range(len(self.headers)):
            name, value, params = self.headers[i]
            msgRoot.add_header(name, value, **params)
        for i in range(len(self.body)):
            part = self.body[i]
            msgRoot.attach(part)
        for i in range(len(self.attachments)):
            attachment = self.attachments[i]
            msgRoot.attach(attachment)
        return msgRoot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号