[issue31052] smtplib not honoring bcc header
zoof
report at bugs.python.org
Wed Jul 26 19:43:32 EDT 2017
New submission from zoof:
When I try sending an email, using smtplib, with the bcc header set, the bcc header is included in messages send to the "to" and "cc" addresses. According to section 4.5.3 of rfc 822:
> The contents of this field are not included in copies of the message sent to the primary and secondary recipients.
So this behavior is incorrect. It should not be up to the mail client to ignore the bcc field.
Here's a script that can replicate the problem:
#!/usr/bin/env python
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
body = "this is a test"
#craft the message
fromaddr = 'ned at example.com'
server = smtplib.SMTP('smtp.example.com', 587)
p = 'Hunter2!'
subject = "test"
toaddr = "foo at example.com"
ccaddr = "bar at example.com"
bccaddr = "baz at example.com"
msg = MIMEMultipart()
msg['cc'] = ccaddr
msg['bcc'] = bccaddr
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = subject
msg.attach(MIMEText(body, 'plain'))
#send the message
server.starttls()
server.login(fromaddr, p)
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
----------
components: Library (Lib)
messages: 299278
nosy: zoof
priority: normal
severity: normal
status: open
title: smtplib not honoring bcc header
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31052>
_______________________________________
More information about the Python-bugs-list
mailing list