tea.msg
Module¶
-
tea.msg.
send_mail
(subject, sender, to, message, html_message=None, cc=None, bcc=None, attachments=None, host=None, port=None, auth_user=None, auth_password=None, use_tls=False, fail_silently=False)[source]¶ Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the ‘To’ field.
Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.
-
tea.msg.
send_mass_mail
(datatuple, fail_silently=False, auth_user=None, auth_password=None)[source]¶ Given a datatuple of (subject, message, sender, recipient_list), sends each message to each recipient list. Returns the number of e-mails sent.
If auth_user and auth_password are set, they’re used to log in.
Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.
Simple and complete library for sending emails
-
class
tea.msg.mail.
SMTPConnection
(host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False)[source]¶ A wrapper that manages the SMTP network connection.
-
class
tea.msg.mail.
EmailMessage
(subject='', body='', sender=None, to=None, cc=None, bcc=None, attachments=None, headers=None, connection=None)[source]¶ A container for email information.
Initialize a single email message (which can be sent to multiple recipients).
All strings used to create the message can be unicode strings (or UTF-8 bytestrings). The SafeMIMEText class will handle any necessary encoding conversions.
-
recipients
()[source]¶ Returns a list of all recipients of the email (includes direct addressees as well as Bcc entries).
-
attach
(filename=None, content=None, mimetype=None)[source]¶ Attaches a file with the given filename and content. The filename can be omitted (useful for multipart/alternative messages) and the mimetype is guessed, if not provided.
If the first parameter is a MIMEBase subclass it is inserted directly into the resulting message attachments.
-
-
class
tea.msg.mail.
EmailMultiAlternatives
(subject='', body='', sender=None, to=None, cc=None, bcc=None, attachments=None, headers=None, connection=None)[source]¶ A version of EmailMessage that makes it easy to send multipart/alternative messages. For example, including text and HTML versions of the text is made easier.
Initialize a single email message (which can be sent to multiple recipients).
All strings used to create the message can be unicode strings (or UTF-8 bytestrings). The SafeMIMEText class will handle any necessary encoding conversions.
-
tea.msg.mail.
send_mail
(subject, sender, to, message, html_message=None, cc=None, bcc=None, attachments=None, host=None, port=None, auth_user=None, auth_password=None, use_tls=False, fail_silently=False)[source]¶ Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the ‘To’ field.
Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.
-
tea.msg.mail.
send_mass_mail
(datatuple, fail_silently=False, auth_user=None, auth_password=None)[source]¶ Given a datatuple of (subject, message, sender, recipient_list), sends each message to each recipient list. Returns the number of e-mails sent.
If auth_user and auth_password are set, they’re used to log in.
Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.