Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/smtplib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ An :class:`SMTP` instance has the following methods:


.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \
mail_options=[], rcpt_options=[])
mail_options=None, rcpt_options=None)

This is a convenience method for calling :meth:`sendmail` with the message
represented by an :class:`email.message.Message` object. The arguments have
Expand Down
6 changes: 5 additions & 1 deletion Lib/smtplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
return senderrs

def send_message(self, msg, from_addr=None, to_addrs=None,
mail_options=[], rcpt_options={}):
mail_options=None, rcpt_options=None):
"""Converts message to a bytestring and passes it to sendmail.

The arguments are as for sendmail, except that msg is an
Expand Down Expand Up @@ -939,6 +939,10 @@ def send_message(self, msg, from_addr=None, to_addrs=None,
msg[header_prefix + 'Cc'])
if f is not None]
to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)]
if mail_options is None:
mail_options = []
if rcpt_options is None:
rcpt_options = []
# Make a local copy so we can delete the bcc headers.
msg_copy = copy.copy(msg)
del msg_copy['Bcc']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed mutable defaults for mail_options and rcpt_options from
`SMTP.send_message`