Sending emails¶
EmailMessage¶
Description:
Fluo EmailMessage improves the original EmailMessage:
it adds a Cc header and accepts a single argument for to, cc and bcc parameters instead of list or tuple
with only one element.
Aruments:
subject: the subject of the emailbody: the body textfrom_email: the sender’s addressto: a string, a list or a tuple of recipient listcc: a string, a list or a tuple of addresses used in ‘Cc’ header when sending the e-mailbcc: a string, a list or a tuple of addresses used in ‘Bcc’ header when sending the e-mailconnection: aSMTPConnectioninstance. Use this parameter if you want to use the same connection for multiple messages. If omitted, a new connection is created whensend()is called.attachments: a list of attachments to put on the message. These can be eitheremail.MIMEBase.MIMEBaseinstance, or(filename, content, mimetype)triples.headers: a dictionary of extra headers to put on the message. The keys are the header name, values are the header values. It’s up to the caller to ensure header names and values are in the correct format for an e-mail message.
Example:
Create a mail message:
mail = EmailMessage(
subject='Hello',
body='Body goes here',
from_email='alert@example.com',
to=['bob@example.com',],
cc=['alice@example.com', 'ted@example.com',],
bcc='chief@example.com',
headers={'Reply-To': 'devnull@example.com'},
)
EmailMultiAlternatives¶
This class acts exactly as EmailMultiAlternatives,
but inherits EmailMessage.