An SMTP instance has the following methods:
level) |
[host[, port]]) |
cmd, [, argstring]) |
This returns a 2-tuple composed of a numeric response code and the actual response line (multiline responses are joined into one long line.)
In normal operation it should not be necessary to call this method explicitly. It is used to implement other methods and may be useful for testing private extensions.
If the connection to the server is lost while waiting for the reply, SMTPServerDisconnected will be raised.
[hostname]) |
In normal operation it should not be necessary to call this method explicitly. It will be implicitly called by the sendmail() when necessary.
[hostname]) |
Unless you wish to use has_extn() before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by sendmail() when necessary.
name) |
1
if name is in the set of SMTP service extensions
returned by the server, 0
otherwise. Case is ignored.
address) |
Note: Many sites disable SMTP "VRFY" in order to foil spammers.
user, password) |
[keyfile[, certfile]]) |
If keyfile and certfile are provided, these are passed to the socket module's ssl() function.
from_addr, to_addrs, msg[, mail_options, rcpt_options]) |
Note: The from_addr and to_addrs parameters are used to construct the message envelope used by the transport agents. The SMTP does not modify the message headers in any way.
If there has been no previous "EHLO" or "HELO" command this session, this method tries ESMTP "EHLO" first. If the server does ESMTP, message size and each of the specified options will be passed to it (if the option is in the feature set the server advertises). If "EHLO" fails, "HELO" will be tried and ESMTP options suppressed.
This method will return normally if the mail is accepted for at least one recipient. Otherwise it will throw an exception. That is, if this method does not throw an exception, then someone should get your mail. If this method does not throw an exception, it returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server.
This method may raise the following exceptions:
Unless otherwise noted, the connection will be open even after an exception is raised.
) |
Low-level methods corresponding to the standard SMTP/ESMTP commands "HELP", "RSET", "NOOP", "MAIL", "RCPT", and "DATA" are also supported. Normally these do not need to be called directly, so they are not documented here. For details, consult the module code.
See About this document... for information on suggesting changes.