class documentation

A minimal SMTP client for MicroPython.

Method __init__ Connect to an SMTP server.
Method cmd Send a command and read the multi-line response.
Method login Authenticate with the SMTP server.
Method quit Send QUIT and close the connection.
Method send Send the message body and termination sequence.
Method to Set the mail recipients and start the DATA phase.
Method write Write raw content to the SMTP socket.
Instance Variable username Undocumented
Instance Variable _sock Undocumented
def __init__(self, host, port, ssl=False, username=None, password=None):

Connect to an SMTP server.

Parameters
host:strThe server hostname.
port:intThe server port.
ssl:boolUse SSL/TLS. Defaults to False.
username:strThe login username. Defaults to None.
password:strThe login password. Defaults to None.
def cmd(self, cmd_str):

Send a command and read the multi-line response.

Parameters
cmd_str:strThe SMTP command to send.
Returns
tuple(code, response lines).
def login(self, username, password):

Authenticate with the SMTP server.

Parameters
username:strThe login username.
password:strThe login password.
Returns
tuple(code, response lines).
def quit(self):

Send QUIT and close the connection.

def send(self, content=''):

Send the message body and termination sequence.

Parameters
content:strThe message body. Defaults to "".
Returns
tuple(code, response text).
def to(self, addrs, mail_from=None):

Set the mail recipients and start the DATA phase.

Parameters
addrs:str or listRecipient address(es).
mail_from:strThe sender address. Defaults to None.
Returns
tuple(code, response lines).
def write(self, content):

Write raw content to the SMTP socket.

Parameters
content:str or bytesThe content to write.
username =

Undocumented

_sock =

Undocumented