简体   繁体   中英

Send mail with python using bcc

我正在使用django,我需要向许多电子邮件发送邮件,我想使用像python-mailer这样的高级库来执行此操作,但是我需要使用密件抄送字段,有什么建议吗?

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 fred@example.com 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM