views:

35

answers:

1

I'm working with django, i need send a mail to many emails, i want to do this with a high level library like python-mailer, but i need use bcc field, any suggestions?

+1  A: 

You should look at the EmailMessage class inside of django, supports the bcc.

Complete docs availble here: http://docs.djangoproject.com/en/dev/topics/email/#the-emailmessage-class

Quick overview:

The EmailMessage class is initialized with the following parameters (in the given order, if positional arguments are used). All parameters are optional and can be set at any time prior to calling the send() method.

  • subject: The subject line of the e-mail.
  • body: The body text. This should be a plain text message.
  • from_email: The sender's address. Both [email protected] and Fred forms are legal. If omitted, the DEFAULT_FROM_EMAIL setting is used.
  • to: A list or tuple of recipient addresses.
  • bcc: A list or tuple of addresses used in the "Bcc" header when sending the e-mail.
  • connection: An e-mail backend instance. Use this parameter if you want to use the same connection for multiple messages. If omitted, a new connection is created when send() is called.
  • attachments: A list of attachments to put on the message. These can be either email.MIMEBase.MIMEBase instances, 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.
koblas