def email(sender=None, receivers=(), cc=(), bcc=(), subject=None, content=None, encoding='utf8', attachments=()): """ Creates a Collection object with a HTML *content*, and *attachments*. :param content: HTML content. :param encoding: Encoding of the email. :param attachments: List of filenames to attach to the email. """ enclosure = [HTML(content, encoding)] enclosure.extend(Attachment(k) for k in attachments) return Collection(*enclosure, headers=[ headers.subject(subject), headers.sender(sender), headers.to(*receivers), headers.cc(*cc), headers.bcc(*bcc), headers.date(), headers.message_id(), ])
def email(sender=None, receivers=(), cc=(), bcc=(), subject=None, content=None, encoding='utf8', attachments=()): """ Creates an Envelope object with a HTML *content*. :param content: HTML content. :param encoding: Encoding of the email. :param attachments: List of filenames to attach to the email. """ html = [HTML(content, encoding)] files = [Attachment(k) for k in attachments] return Envelope( headers=[ headers.subject(subject), headers.sender(sender), headers.to(*receivers), headers.cc(*cc), headers.bcc(*bcc), headers.date(), headers.message_id(), ], enclosure=(html + files), )
def headers(self): return Headers([ ('From', '*****@*****.**'), sender('*****@*****.**'), to('*****@*****.**'), cc('*****@*****.**', '*****@*****.**'), bcc('*****@*****.**', '*****@*****.**'), ])
def envelope(): env = Envelope( headers=[sender('Me <*****@*****.**>'), to('*****@*****.**'), subject('subject')], enclosure=[PlainText('Hi!')], ) env.string = Mock(return_value='--email--') return env
def envelope(): env = Envelope( headers=[ sender('Me <*****@*****.**>'), to('*****@*****.**'), subject('subject') ], enclosure=[PlainText('Hi!')], ) env.string = Mock(return_value='--email--') return env
def envelope(self): return Envelope( headers=[ sender('Me <*****@*****.**>'), to('*****@*****.**', '*****@*****.**'), subject('subject'), ], enclosure=[ PlainText('hi!'), PlainText('bye!'), ], )