pysys.utils.smtpserver module

class pysys.utils.smtpserver.SimpleSMTPServer(localaddr, remoteaddr, filename='smtpserver.out', logMails=True)[source]

Bases: smtpd.SMTPServer

__init__(localaddr, remoteaddr, filename='smtpserver.out', logMails=True)[source]

Initialize self. See help(type(self)) for accurate signature.

process_message(peer, mailfrom, rcpttos, data)[source]

Override this abstract method to handle messages from the client.

peer is a tuple containing (ipaddr, port) of the client that made the socket connection to our smtp port.

mailfrom is the raw address the client claims the message is coming from.

rcpttos is a list of raw addresses the client wishes to deliver the message to.

data is a string containing the entire full text of the message, headers (if supplied) and all. It has been `de-transparencied’ according to RFC 821, Section 4.5.2. In other words, a line containing a `.’ followed by other text has had the leading dot removed.

kwargs is a dictionary containing additional information. It is empty if decode_data=True was given as init parameter, otherwise it will contain the following keys:

‘mail_options’: list of parameters to the mail command. All
elements are uppercase strings. Example: [‘BODY=8BITMIME’, ‘SMTPUTF8’].

‘rcpt_options’: same, for the rcpt command.

This function should return None for a normal `250 Ok’ response; otherwise, it should return the desired response string in RFC 821 format.

class pysys.utils.smtpserver.SimpleSMTPServerRunner[source]

Bases: object

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

kickoff()[source]
start()[source]
stop()[source]