首先,我尝试使用['BCC']标题和收件人列表,但这导致BCC字段可见,所有收件人也可见。
我在SO上读到,如果我遗漏了BCC标题并将收件人直接放入sendmail函数中,它将发送而不向收件人显示。不。仍然没有奏效。收件人都可见,但仍显示“BCC”image of how it shows up in gmail
标签建议?我希望收件人列表对其他收件人隐藏。
# Send TV Email
msg2 = MIMEMultipart()
msg2['From'] = fromaddr
msg2['To'] = toaddr
msg2['Subject'] = "Welcome Message from Puls"
msg2['Reply-to'] = "alister@puls.com"
msg2.add_header('reply-to', fromaddr)
body2 = """Hello New Puls Technician!"""
msg2.attach(MIMEText(body2, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('email', "password")
text = msg2.as_string()
server.sendmail(fromaddr, newTvTechsEmailList, text)
server.quit()
答案 0 :(得分:0)
查看mrts/send-email-hide-recipients.py:
from django.core.mail import send_mass_mail
subject = 'test subject'
message = 'test message'
from_email = 'from@from.com'
recipient_list = ['a@a.com', 'b@b.com', 'c@c.com']
messages = [(subject, message, from_email, [recipient]) for recipient in recipient_list]
send_mass_mail(messages)