pymilter  0.9.6
Public Member Functions | List of all members
Milter.Milter Class Reference

A logging but otherwise do nothing Milter base class. More...

Inheritance diagram for Milter.Milter:
Milter.Base

Public Member Functions

def log
 Provide simple logging to sys.stdout.
def connect
 Called for each connection to the MTA.
def hello
 Called when the SMTP client says HELO.
def envfrom
def envrcpt
 Called when the SMTP client says RCPT TO.
def header
 Called for each header field in the message body.
def eoh
 Called at the blank line that terminates the header fields.
def eom
 Called at the end of the message body.
def abort
 Called when the connection is abnormally terminated.
def close
 Called when the connection is closed.
- Public Member Functions inherited from Milter.Base
def data
 Called when the SMTP client says DATA.
def body
 Called to supply the body of the message to the Milter by chunks.
def unknown
 Called when the SMTP client issues an unknown command.
def protocol_mask
 Return mask of SMFIP_N* protocol option bits to clear for this class The @nocallback and @noreply decorators set the milter_protocol function attribute to the protocol mask bit to pass to libmilter, causing that callback or its reply to be skipped.
def negotiate
 Negotiate milter protocol options.
def getsymval
 Return the value of an MTA macro.
def setreply
 Set the SMTP reply code and message.
def setsmlist
 Tell the MTA which macro names will be used.
def addheader
 Add a mail header field.
def chgheader
 Change the value of a mail header field.
def addrcpt
 Add a recipient to the message.
def delrcpt
 Delete a recipient from the message.
def replacebody
 Replace the message body.
def chgfrom
 Change the SMTP envelope sender address.
def quarantine
 Quarantine the message.
def progress
 Tell the MTA to wait a bit longer.

Detailed Description

A logging but otherwise do nothing Milter base class.

This is included for compatibility with previous versions of pymilter. The logging callbacks are marked @noreply.

Member Function Documentation

def Milter.Milter.abort (   self)

Called when the connection is abnormally terminated.

The close callback is still called also.

Reimplemented from Milter.Base.

def Milter.Milter.close (   self)

Called when the connection is closed.

Reimplemented from Milter.Base.

def Milter.Milter.connect (   self,
  hostname,
  family,
  hostaddr 
)

Called for each connection to the MTA.

Called by the xxfi_connect callback. The hostname provided by the local MTA is either the PTR name or the IP in the form "[1.2.3.4]" if no PTR is available. The format of hostaddr depends on the socket family:

socket.AF_INET
A tuple of (IP as string in dotted quad form, integer port)
socket.AF_INET6
A tuple of (IP as a string in standard representation, integer port, integer flow info, integer scope id)
socket.AF_UNIX
A string with the socketname

To vary behavior based on what port the client connected to, for example skipping blacklist checks for port 587 (which must be authenticated), use getsymval('{daemon_port}') . The {daemon_port} macro must be enabled in sendmail.cf

 O Milter.macros.connect=j, _, {daemon_name}, {daemon_port}, {if_name}, {if_addr}
 

or sendmail.mc

 define(`confMILTER_MACROS_CONNECT', ``j, _, {daemon_name}, {daemon_port}, {if_name}, {if_addr}'')dnl
 
Parameters
hostnamethe PTR name or bracketed IP of the SMTP client
familysocket.AF_INET, socket.AF_INET6, or socket.AF_UNIX
hostaddra tuple or string with peer IP or socketname

Reimplemented from Milter.Base.

def Milter.Milter.envfrom (   self,
  f,
  str 
)
Called to begin each message.
f -> string             message sender
str -> tuple    additional ESMTP parameters

Reimplemented from Milter.Base.

def Milter.Milter.envrcpt (   self,
  to,
  str 
)

Called when the SMTP client says RCPT TO.

Called by the xxfi_envrcpt callback. Returning REJECT rejects the current recipient, not the entire message. The recipient is the "envelope" recipient as defined by RFC 5321. For recipients defined in RFC 5322, for example To: or Cc:, see the header callback .

Reimplemented from Milter.Base.

def Milter.Milter.eoh (   self)

Called at the blank line that terminates the header fields.

Reimplemented from Milter.Base.

def Milter.Milter.eom (   self)

Called at the end of the message body.

Most of the message manipulation actions can only take place from the eom callback.

Reimplemented from Milter.Base.

def Milter.Milter.header (   self,
  field,
  value 
)

Called for each header field in the message body.

Reimplemented from Milter.Base.

def Milter.Milter.hello (   self,
  hostname 
)

Called when the SMTP client says HELO.

Returning REJECT prevents progress until a valid HELO is provided; this almost always results in terminating the connection.

Reimplemented from Milter.Base.


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