An SMTP instance has the following methods:
If the hostname ends with a colon (":") followed by a number, that suffix will be stripped off and the number interpreted as the port number to use.
Note: This method is automatically invoked by the constructor if a host is specified during instantiation.
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.
In normal operation it should not be necessary to call this method explicitly. It will be implicitly called by the sendmail() when necessary.
Unless you wish to use has_option() before sending mail, it should not be necessary to call this method explicitly. It will be implicitly called by sendmail() when necessary.
1if name is in the set of SMTP service extensions returned by the server,
0otherwise. Case is ignored.
Note: many sites disable SMTP "VRFY" in order to foil spammers.
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.