pymilter 1.0.5
Public Member Functions | List of all members
milter.milterContext Class Reference

Hold context for a milter connection. More...

Inheritance diagram for milter.milterContext:

Public Member Functions

 getsymval (self, sym)
 Calls smfi_getsymval.
 
 setreply (self, rcode, xcode, *msg)
 Calls smfi_setreply or smfi_setmlreply.
 
 addheader (self, name, value, idx=-1)
 Calls smfi_addheader.
 
 chgheader (self, name, idx, value)
 Calls smfi_chgheader.
 
 addrcpt (self, rcpt, params=None)
 Calls smfi_addrcpt.
 
 delrcpt (self, rcpt)
 Calls smfi_delrcpt.
 
 replacebody (self, data)
 Calls smfi_replacebody.
 
 setpriv (self, priv)
 Attach a Python object to this connection context.
 
 getpriv (self)
 Return the Python object attached to this connection context.
 
 quarantine (self, reason)
 Calls smfi_quarantine.
 
 progress (self)
 Calls smfi_progress.
 
 chgfrom (self, sender, param=None)
 Calls smfi_chgfrom.
 
 setsymlist (self, stage, macrolist)
 Tell the MTA which macro values we are interested in for a given stage.
 

Detailed Description

Hold context for a milter connection.

Each connection to sendmail creates a new SMFICTX struct within libmilter. The milter module in turn creates a milterContext tied to the SMFICTX struct via smfi_setpriv to hold a PyThreadState and a user defined Python object for the connection.

Most application interaction with libmilter takes places via the milterContext object for the connection. It is passed to callback functions as the first parameter.

The Milter module creates a python class for each connection, and converts function callbacks to instance method invocations.

Member Function Documentation

◆ setpriv()

milter.milterContext.setpriv (   self,
  priv 
)

Attach a Python object to this connection context.

Returns
the old value or None

◆ setreply()

milter.milterContext.setreply (   self,
  rcode,
  xcode,
msg 
)

Calls smfi_setreply or smfi_setmlreply.

Parameters
rcodeSMTP response code
xcodeextended SMTP response code
msgone or more message lines. If the MTA does not support multiline messages, only the first is used.

◆ setsymlist()

milter.milterContext.setsymlist (   self,
  stage,
  macrolist 
)

Tell the MTA which macro values we are interested in for a given stage.

Of interest only when you need to squeeze a few more bytes of bandwidth. It may only be called from the negotiate callback. The protocol stages are M_CONNECT, M_HELO, M_ENVFROM, M_ENVRCPT, M_DATA, M_EOM, M_EOH. Calls smfi_setsymlist.

Parameters
stageprotocol stage in which the macro list should be used
macrolista space separated list of macro names

Referenced by Milter.Base.negotiate().


The documentation for this class was generated from the following file: