smtplib.LMTP¶
-
class
smtplib.LMTP(host='', port=2003, local_hostname=None)[source]¶ LMTP - Local Mail Transfer Protocol
The LMTP protocol, which is very similar to ESMTP, is heavily based on the standard SMTP client. It’s common to use Unix sockets for LMTP, so our connect() method must support that as well as a regular host:port server. local_hostname has the same meaning as it does in the SMTP class. To specify a Unix socket, you must use an absolute path as the host, starting with a ‘/’.
Authentication is supported, using the regular SMTP mechanism. When using a Unix socket, LMTP generally don’t support or require any authentication, but your mileage might vary.
Methods¶
__init__([host, port, local_hostname]) |
Initialize a new instance. |
_get_socket(host, port, timeout) |
|
close() |
Close the connection to the SMTP server. |
connect([host, port]) |
Connect to the LMTP daemon, on either a Unix or a TCP socket. |
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. |
Attributes¶
debuglevel |
|
default_port |
|
does_esmtp |
|
ehlo_msg |
|
ehlo_resp |
|
file |
|
helo_resp |