sendable_email.py 文件源码

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

项目:django-email-pal 作者: 18F 项目源码 文件源码
def create_message(self, ctx: T, from_email=None, to=None, bcc=None,
                       connection=None, attachments=None, headers=None,
                       alternatives=None, cc=None,
                       reply_to=None) -> EmailMessage:
        '''
        Creates and returns a :py:class:`django.core.mail.EmailMessage`
        which contains the plaintext and HTML versions of the email,
        using the context specified by ``ctx``.

        Aside from ``ctx``, arguments to this method are the
        same as those for :py:class:`~django.core.mail.EmailMessage`.
        '''

        msg = EmailMultiAlternatives(
            subject=self.render_subject(ctx),
            body=self.render_body_as_plaintext(ctx),
            from_email=from_email,
            to=to,
            bcc=bcc,
            connection=connection,
            attachments=attachments,
            headers=headers,
            alternatives=alternatives,
            cc=cc,
            reply_to=reply_to,
        )
        msg.attach_alternative(self.render_body_as_html(ctx), 'text/html')
        return msg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号