与隐藏的收件人发送群发邮件 [英] Send mass mail with hidden recipients

查看:106
本文介绍了与隐藏的收件人发送群发邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Django应用程序中具有向所有注册用户发送电子邮件的功能,我目前正在使用'EmailMessage'进行发送,并且运行良好,但是每个人都可以看到其他收件人的电子邮件,这是不受欢迎的.

I have a functionality in a Django app to send an email to all the registered users, I'm currently doing it with 'EmailMessage' and it works perfectly but everybody gets to see every other recipient's email which is unwanted.

是否可以使用Django邮件发送功能隐藏收件人?

Is there a way to hide recipients using the Django mailing functions?

谢谢.

推荐答案

当实例化EmailMessage类时,您可以提供bcc属性,例如示例.

when you instantiate EmailMessage class you can provide bcc attribute such as the example.

这是EmailMessage类

Here is the EmailMessage class

class EmailMessage(object):
"""
A container for email information.
"""
content_subtype = 'plain'
mixed_subtype = 'mixed'
encoding = None     # None => use settings default

def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
             connection=None, attachments=None, headers=None, cc=None):

因此,如果您为密件抄送收件人提供属性名称.您可以将目标电子邮件设置为密件抄送收件人.

so if you provide bcc recipient with the attribute name. you can set the target email as bcc recipient.

message = EmailMessage('hello', 'body', bcc=['user@email.com',])
message.send()

这篇关于与隐藏的收件人发送群发邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆