class documentation

class SMTP(basic.LineOnlyReceiver, policies.TimeoutMixin): (source)

Known subclasses: twisted.mail.smtp.ESMTP

View In Hierarchy

SMTP server-side protocol.
Method __init__ Undocumented
Method connection​Lost Called when the connection is shut down.
Method connection​Made Called when a connection is made.
Method data​Line​Received Undocumented
Method do_​DATA Undocumented
Method do_​HELO Undocumented
Method do_​MAIL Undocumented
Method do_​QUIT Undocumented
Method do_​RCPT Undocumented
Method do_​RSET Undocumented
Method do_​UNKNOWN Undocumented
Method greeting Undocumented
Method host​.setter Undocumented
Method line​Length​Exceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method line​Received Override this for when each line is received.
Method lookup​Method
Method received​Header Undocumented
Method send​Code Send an SMTP code with a message.
Method send​Syntax​Error Undocumented
Method state_​COMMAND Undocumented
Method timeout​Connection Called when the connection times out.
Method validate​From Validate the address from which the message originates.
Method validate​To Validate the address for which the message is destined.
Class Variable mail​_re Undocumented
Class Variable noisy Undocumented
Class Variable portal Undocumented
Class Variable qstring Undocumented
Class Variable rcpt​_re Undocumented
Class Variable timeout Undocumented
Instance Variable challenger Undocumented
Instance Variable datafailed Undocumented
Instance Variable delivery Undocumented
Instance Variable delivery​Factory Undocumented
Instance Variable mode Undocumented
Property host Undocumented
Method _cb​Anonymous​Authentication Save the state resulting from a successful anonymous cred login.
Method _cb​From​Validate Undocumented
Method _cb​To​Validate Undocumented
Method _disconnect Undocumented
Method _eb​From​Validate Undocumented
Method _eb​To​Validate Undocumented
Method _message​Handled Undocumented
Instance Variable __inbody Undocumented
Instance Variable __inheader Undocumented
Instance Variable __messages Undocumented
Instance Variable _from Undocumented
Instance Variable _helo Undocumented
Instance Variable _host Undocumented
Instance Variable _on​Logout Undocumented
Instance Variable _to Undocumented

Inherited from LineOnlyReceiver:

Method data​Received Translates bytes into lines, and calls lineReceived.
Method send​Line Sends a line to the other end of the connection.
Constant MAX​_LENGTH The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.
Class Variable delimiter The line-ending delimiter to use. By default this is b'\r\n'.
Instance Variable _buffer Undocumented

Inherited from Protocol (via LineOnlyReceiver):

Method log​Prefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via LineOnlyReceiver, Protocol):

Method make​Connection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented

Inherited from TimeoutMixin:

Method call​Later Wrapper around reactor.callLater for test purpose.
Method reset​Timeout Reset the timeout count down.
Method set​Timeout Change the timeout period
Instance Variable time​Out The number of seconds after which to timeout the connection.
Method __timed​Out Undocumented
Instance Variable __timeout​Call Undocumented
def __init__(self, delivery=None, deliveryFactory=None): (source)

Undocumented

def connectionLost(self, reason): (source)

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Parameters
reason:twisted.python.failure.FailureUndocumented
def connectionMade(self): (source)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def dataLineReceived(self, line): (source)

Undocumented

def do_DATA(self, rest): (source)

Undocumented

def do_HELO(self, rest): (source)

Undocumented

def do_MAIL(self, rest): (source)

Undocumented

def do_QUIT(self, rest): (source)

Undocumented

def do_RCPT(self, rest): (source)

Undocumented

def do_RSET(self, rest): (source)

Undocumented

def do_UNKNOWN(self, rest): (source)

Undocumented

def greeting(self): (source)

Undocumented

@host.setter
def host(self, toSet): (source)

Undocumented

def lineLengthExceeded(self, line): (source)
Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
def lineReceived(self, line): (source)
Override this for when each line is received.
Parameters
line:bytesThe line which was received with the delimiter removed.
def lookupMethod(self, command): (source)
Parameters
command:strThe command to get from this class.
Returns
The function which executes this command.
def receivedHeader(self, helo, origin, recipients): (source)

Undocumented

def sendCode(self, code, message=b''): (source)
Send an SMTP code with a message.
def sendSyntaxError(self): (source)

Undocumented

def state_COMMAND(self, line): (source)

Undocumented

def timeoutConnection(self): (source)

Called when the connection times out.

Override to define behavior other than dropping the connection.

def validateFrom(self, helo, origin): (source)
Validate the address from which the message originates.
Parameters
helo:(bytes, bytes)The argument to the HELO command and the client's IP address.
origin:AddressThe address the message is from
Returns
Deferred or Addressorigin or a Deferred whose callback will be passed origin.
Raises
SMTPBadSenderRaised of messages from this address are not to be accepted.
def validateTo(self, user): (source)
Validate the address for which the message is destined.
Parameters
user:UserThe address to validate.
Returns
no-argument callableA Deferred which becomes, or a callable which takes no arguments and returns an object implementing IMessage. This will be called and the returned object used to deliver the message when it arrives.
Raises
SMTPBadRcptRaised if messages to the address are not to be accepted.
mail_re = (source)

Undocumented

noisy: bool = (source)

Undocumented

portal = (source)

Undocumented

qstring = (source)

Undocumented

rcpt_re = (source)

Undocumented

timeout: int = (source)

Undocumented

challenger = (source)

Undocumented

datafailed = (source)

Undocumented

delivery = (source)

Undocumented

deliveryFactory = (source)

Undocumented

mode = (source)

Undocumented

Undocumented

def _cbAnonymousAuthentication(self, result): (source)
Save the state resulting from a successful anonymous cred login.
def _cbFromValidate(self, fromEmail, code=250, msg=b'Sender address accepted'): (source)

Undocumented

def _cbToValidate(self, to, user=None, code=250, msg=b'Recipient address accepted'): (source)

Undocumented

def _disconnect(self, msgs): (source)

Undocumented

def _ebFromValidate(self, failure): (source)

Undocumented

def _ebToValidate(self, failure): (source)

Undocumented

def _messageHandled(self, resultList): (source)

Undocumented

__inbody: int = (source)

Undocumented

__inheader: int = (source)

Undocumented

__messages = (source)

Undocumented

_from = (source)

Undocumented

_helo = (source)

Undocumented

_host = (source)

Undocumented

_onLogout = (source)

Undocumented

Undocumented