smtplib.SMTP_SSL

class smtplib.SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None, timeout=<object object>)[source]

This is a subclass derived from SMTP that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled with SSL support). If host is not specified, ‘’ (the local host) is used. If port is omitted, the standard SMTP-over-SSL port (465) is used. local_hostname has the same meaning as it does in the SMTP class. keyfile and certfile are also optional - they can contain a PEM formatted private key and certificate chain file for the SSL connection.

Methods

__init__([host, port, local_hostname, ...])
_get_socket(host, port, timeout)
close() Close the connection to the SMTP server.
connect([host, port]) Connect to a host on a given port.
data(msg) SMTP ‘DATA’ command – sends message data to server.
docmd(cmd[, args]) Send a command, and return its response code.
ehlo([name]) SMTP ‘ehlo’ command.
ehlo_or_helo_if_needed() Call self.ehlo() and/or self.helo() if needed.
expn(address) SMTP ‘expn’ command – expands a mailing list.
getreply() Get a reply from the server.
has_extn(opt) Does the server support a given SMTP service extension?
helo([name]) SMTP ‘helo’ command.
help([args]) SMTP ‘help’ command.
login(user, password) Log in on an SMTP server that requires authentication.
mail(sender[, options]) SMTP ‘mail’ command – begins mail xfer session.
noop() SMTP ‘noop’ command – doesn’t do anything :>
putcmd(cmd[, args]) Send a command to the server.
quit() Terminate the SMTP session.
rcpt(recip[, options]) SMTP ‘rcpt’ command – indicates 1 recipient for this mail.
rset() SMTP ‘rset’ command – resets session.
send(str) Send `str’ to the server.
sendmail(from_addr, to_addrs, msg[, ...]) This command performs an entire mail transaction.
set_debuglevel(debuglevel) Set the debug output level.
starttls([keyfile, certfile]) Puts the connection to the SMTP server into TLS mode.
verify(address) SMTP ‘verify’ command – checks for address validity.
vrfy(address) SMTP ‘verify’ command – checks for address validity.