Send an email.

This interface is intended to be a replacement for smtplib.SMTP.sendmail and related methods. To maintain backwards compatibility, it will fall back to plain SMTP, if ESMTP support is not available. If ESMTP support is available, it will attempt to provide encryption via STARTTLS and authentication if a secret is provided.

ParameterssmtphostThe host the message should be sent to. (type: bytes)
from_addrThe (envelope) address sending this mail. (type: bytes)
to_addrsA list of addresses to send this mail to. A string will be treated as a list of one address.
msgThe message, including headers, either as a file or a string. File-like objects need to support read() and close(). Lines must be delimited by '\n'. If you pass something that doesn't look like a file, we try to convert it to a string (so you should be able to pass an email.Message directly, but doing the conversion with email.Generator manually will give you more control over the process).
senderDomainNameName by which to identify. If None, try to pick something sane (but this depends on external configuration and may not succeed). (type: bytes)
portRemote port to which to connect. (type: int)
usernameThe username to use, if wanting to authenticate. (type: bytes)
passwordThe secret to use, if wanting to authenticate. If you do not specify this, SMTP authentication will not occur. (type: bytes)
requireTransportSecurityWhether or not STARTTLS is required. (type: bool)
requireAuthenticationWhether or not authentication is required. (type: bool)
reactorThe reactor used to make the TCP connection.
ReturnsA cancellable Deferred, its callback will be called if a message is sent to ANY address, the errback if no message is sent. When the cancel method is called, it will stop retrying and disconnect the connection immediately.

The callback will be called with a tuple (numOk, addresses) where numOk is the number of successful recipient addresses and addresses is a list of tuples (address, code, resp) giving the response to the RCPT command for each address.

(type: Deferred)
API Documentation for Twisted, generated by pydoctor at 2015-05-24 20:04:00.