sendmail(smtphost,
from_addr,
to_addrs,
msg)
Send an email
This interface is intended to be a direct replacement for
smtplib.SMTP.sendmail() (with the obvious change that you specify the
smtphost as well). Also, ESMTP options are not accepted, as we don't do
ESMTP yet. I reserve the right to implement the ESMTP options
differently.
-
- Parameters:
smtphost -
The host the message should be sent to
from_addr -
The (envelope) address sending this mail.
to_addrs -
A list of addresses to send this mail to. A string will be treated as
a list of one address
msg -
The message, including headers, either as a file or a string.
File-like objects need to support read() and close(). Line
endings must be local (i.e. '\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 using generator manually and passing the file
object is probably more efficient).
- Returns:
-
A Deferred , its callback will be called if a message is
sent to ANY address, the errback if no message is sent.
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 )
|