PyDocs

Nav

Internet Protocols and Support

SMTP.send_message

smtplib

method of SMTP · Added in 3.2 (source) not WASI
  • SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=(), rcpt_options=())
Converts message to a bytestring and passes it to sendmail.

The arguments are as for sendmail, except that msg is an
email.message.Message object.  If from_addr is None or to_addrs is
None, these arguments are taken from the headers of the Message as
described in RFC 5322 (a ValueError is raised if there is more than
one set of 'Resent-' headers).  Regardless of the values of from_addr and
to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
resent) of the Message object won't be transmitted.  The Message
object is then serialized using email.generator.BytesGenerator and
sendmail is called to transmit the message.  If the sender or any of
the recipient addresses contain non-ASCII and the server advertises the
SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
If the server does not support SMTPUTF8, an SMTPNotSupported error is
raised.  Otherwise the generator is called without modifying the
policy.
Changed in 3.5
  • 3.5: Support for internationalized addresses (SMTPUTF8).
0 Examples
No examples for smtplib/SMTP.send_message.
See Also
No see-alsos for smtplib/SMTP.send_message
0 Notes
No notes for SMTP.send_message