\section{Milter.\+Base Class Reference}
\label{classMilter_1_1Base}\index{Milter.\+Base@{Milter.\+Base}}


A do \char`\"{}nothing\char`\"{} \doxyref{Milter}{p.}{classMilter_1_1Milter} base class representing an S\+M\+T\+P connection.  


Inheritance diagram for Milter.\+Base\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classMilter_1_1Base}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
def {\bf log} (self, msg)
\begin{DoxyCompactList}\small\item\em Defined by subclasses to write log messages. \end{DoxyCompactList}\item 
def {\bf connect} (self, hostname, family, hostaddr)
\begin{DoxyCompactList}\small\item\em Called for each connection to the M\+T\+A. \end{DoxyCompactList}\item 
def {\bf hello} (self, hostname)
\begin{DoxyCompactList}\small\item\em Called when the S\+M\+T\+P client says H\+E\+L\+O. \end{DoxyCompactList}\item 
def {\bf envfrom} (self, f, str)
\begin{DoxyCompactList}\small\item\em Called when the S\+M\+T\+P client says M\+A\+I\+L F\+R\+O\+M. \end{DoxyCompactList}\item 
def {\bf envrcpt} (self, to, str)
\begin{DoxyCompactList}\small\item\em Called when the S\+M\+T\+P client says R\+C\+P\+T T\+O. \end{DoxyCompactList}\item 
def {\bf data} (self)
\begin{DoxyCompactList}\small\item\em Called when the S\+M\+T\+P client says D\+A\+T\+A. \end{DoxyCompactList}\item 
def {\bf header} (self, field, value)
\begin{DoxyCompactList}\small\item\em Called for each header field in the message body. \end{DoxyCompactList}\item 
def {\bf eoh} (self)
\begin{DoxyCompactList}\small\item\em Called at the blank line that terminates the header fields. \end{DoxyCompactList}\item 
def {\bf body} (self, blk)
\begin{DoxyCompactList}\small\item\em Called to supply the body of the message to the \doxyref{Milter}{p.}{classMilter_1_1Milter} by chunks. \end{DoxyCompactList}\item 
def {\bf unknown} (self, cmd)
\begin{DoxyCompactList}\small\item\em Called when the S\+M\+T\+P client issues an unknown command. \end{DoxyCompactList}\item 
def {\bf eom} (self)
\begin{DoxyCompactList}\small\item\em Called at the end of the message body. \end{DoxyCompactList}\item 
def {\bf abort} (self)
\begin{DoxyCompactList}\small\item\em Called when the connection is abnormally terminated. \end{DoxyCompactList}\item 
def {\bf close} (self)
\begin{DoxyCompactList}\small\item\em Called when the connection is closed. \end{DoxyCompactList}\item 
def {\bf protocol\+\_\+mask} (klass)
\begin{DoxyCompactList}\small\item\em Return mask of S\+M\+F\+I\+P\+\_\+\+N$\ast$ protocol option bits to clear for this class The @nocallback and @noreply decorators set the {\ttfamily milter\+\_\+protocol} function attribute to the protocol mask bit to pass to libmilter, causing that callback or its reply to be skipped. \end{DoxyCompactList}\item 
def {\bf negotiate} (self, opts)
\begin{DoxyCompactList}\small\item\em Negotiate milter protocol options. \end{DoxyCompactList}\item 
def {\bf getsymval} (self, sym)
\begin{DoxyCompactList}\small\item\em Return the value of an M\+T\+A macro. \end{DoxyCompactList}\item 
def {\bf setreply} (self, rcode, xcode=None, msg=None, ml)
\begin{DoxyCompactList}\small\item\em Set the S\+M\+T\+P reply code and message. \end{DoxyCompactList}\item 
def {\bf setsymlist} (self, stage, macros)
\begin{DoxyCompactList}\small\item\em Tell the M\+T\+A which macro names will be used. \end{DoxyCompactList}\item 
def {\bf addheader}
\begin{DoxyCompactList}\small\item\em Add a mail header field. \end{DoxyCompactList}\item 
def {\bf chgheader} (self, field, idx, value)
\begin{DoxyCompactList}\small\item\em Change the value of a mail header field. \end{DoxyCompactList}\item 
def {\bf addrcpt}
\begin{DoxyCompactList}\small\item\em Add a recipient to the message. \end{DoxyCompactList}\item 
def {\bf delrcpt} (self, rcpt)
\begin{DoxyCompactList}\small\item\em Delete a recipient from the message. \end{DoxyCompactList}\item 
def {\bf replacebody} (self, {\bf body})
\begin{DoxyCompactList}\small\item\em Replace the message body. \end{DoxyCompactList}\item 
def {\bf chgfrom}
\begin{DoxyCompactList}\small\item\em Change the S\+M\+T\+P envelope sender address. \end{DoxyCompactList}\item 
def {\bf quarantine} (self, reason)
\begin{DoxyCompactList}\small\item\em Quarantine the message. \end{DoxyCompactList}\item 
def {\bf progress} (self)
\begin{DoxyCompactList}\small\item\em Tell the M\+T\+A to wait a bit longer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
def {\bf \+\_\+setctx} (self, ctx)
\begin{DoxyCompactList}\small\item\em Attach this \doxyref{Milter}{p.}{classMilter_1_1Milter} to the low level \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} object. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
{\bf \+\_\+ctx}
\begin{DoxyCompactList}\small\item\em The low level \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} object. \end{DoxyCompactList}\item 
{\bf \+\_\+actions}
\begin{DoxyCompactList}\small\item\em A bitmask of actions this connection has negotiated to use. \end{DoxyCompactList}\item 
{\bf \+\_\+protocol}
\begin{DoxyCompactList}\small\item\em A bitmask of protocol options this connection has negotiated. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
A do \char`\"{}nothing\char`\"{} \doxyref{Milter}{p.}{classMilter_1_1Milter} base class representing an S\+M\+T\+P connection. 

Python milters should derive from this class unless they are using the low level milter module directly.

Most of the methods are either \char`\"{}actions\char`\"{} or \char`\"{}callbacks\char`\"{}. Callbacks are invoked by the M\+T\+A at certain points in the S\+M\+T\+P protocol. For instance when the H\+E\+L\+O command is seen, the M\+T\+A calls the helo callback before returning a response code. All callbacks must return one of these constants\+: C\+O\+N\+T\+I\+N\+U\+E, T\+E\+M\+P\+F\+A\+I\+L, R\+E\+J\+E\+C\+T, A\+C\+C\+E\+P\+T, D\+I\+S\+C\+A\+R\+D, S\+K\+I\+P. The N\+O\+R\+E\+P\+L\+Y response is supplied automatically by the @noreply decorator if negotiation with the M\+T\+A is successful. @noreply and @nocallback methods should return C\+O\+N\+T\+I\+N\+U\+E for two reasons\+: the M\+T\+A may not support negotiation, and the class may be running in a test harness.

Optional callbacks are disabled with the @nocallback decorator, and automatically reenabled when overridden. Disabled callbacks should still return C\+O\+N\+T\+I\+N\+U\+E for testing and M\+T\+As that do not support negotiation. 

\subsection{Member Function Documentation}
\index{Milter\+::\+Base@{Milter\+::\+Base}!\+\_\+setctx@{\+\_\+setctx}}
\index{\+\_\+setctx@{\+\_\+setctx}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{\+\_\+setctx}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+\_\+setctx (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{ctx}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1Base_ae03b64fb40aea2819c29ad806ac5f7ea}


Attach this \doxyref{Milter}{p.}{classMilter_1_1Milter} to the low level \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} object. 

\index{Milter\+::\+Base@{Milter\+::\+Base}!abort@{abort}}
\index{abort@{abort}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{abort}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+abort (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_aef01a2465e563ad1435030cfc9b30939}


Called when the connection is abnormally terminated. 

The close callback is still called also. \index{Milter\+::\+Base@{Milter\+::\+Base}!addheader@{addheader}}
\index{addheader@{addheader}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{addheader}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+addheader (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{field, }
\item[{}]{value, }
\item[{}]{idx = {\ttfamily -\/1}}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a8a931265e47cb0080f1c87b4613450b0}


Add a mail header field. 

Calls {\tt smfi\+\_\+addheader}. The {\ttfamily Milter.\+A\+D\+D\+H\+D\+R\+S} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em field} & the header field name \\
\hline
{\em value} & the header field value \\
\hline
{\em idx} & header field index from the top of the message to insert at \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if A\+D\+D\+H\+D\+R\+S is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!addrcpt@{addrcpt}}
\index{addrcpt@{addrcpt}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{addrcpt}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+addrcpt (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{rcpt, }
\item[{}]{params = {\ttfamily None}}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_ac046964404f7d871e1972ffaee980e16}


Add a recipient to the message. 

Calls {\tt smfi\+\_\+addrcpt}. If no corresponding mail header is added, this is like a Bcc. The syntax of the recipient is the same as used in the S\+M\+T\+P R\+C\+P\+T T\+O command (and as delivered to the envrcpt callback), for example \char`\"{}self.\+addrcpt(\textquotesingle{}$<$foo@example.\+com$>$\textquotesingle{})\char`\"{}. The {\ttfamily Milter.\+A\+D\+D\+R\+C\+P\+T} action flag must be set. If the optional {\ttfamily params} argument is used, then the {\ttfamily Milter.\+A\+D\+D\+R\+C\+P\+T\+\_\+\+P\+A\+R} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em rcpt} & the message recipient \\
\hline
{\em params} & an optional list of E\+S\+M\+T\+P parameters \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if A\+D\+D\+R\+C\+P\+T or A\+D\+D\+R\+C\+P\+T\+\_\+\+P\+A\+R is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!body@{body}}
\index{body@{body}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{body}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+body (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{blk}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a963e42c7fcf7bb1a967af48c878b00c7}


Called to supply the body of the message to the \doxyref{Milter}{p.}{classMilter_1_1Milter} by chunks. 


\begin{DoxyParams}{Parameters}
{\em blk} & a block of message bytes \\
\hline
\end{DoxyParams}


Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!chgfrom@{chgfrom}}
\index{chgfrom@{chgfrom}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{chgfrom}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+chgfrom (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{sender, }
\item[{}]{params = {\ttfamily None}}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a335f663024d3ec97c5950090c318e205}


Change the S\+M\+T\+P envelope sender address. 

Calls {\tt smfi\+\_\+chgfrom}. The syntax of the sender is that same as used in the S\+M\+T\+P M\+A\+I\+L F\+R\+O\+M command (and as delivered to the envfrom callback), for example {\ttfamily self.\+chgfrom(\textquotesingle{}{\tt bar@example.\+com}\textquotesingle{})}. The {\ttfamily Milter.\+C\+H\+G\+F\+R\+O\+M} action flag must be set.

May be called from eom callback only. \begin{DoxySince}{Since}
0.\+9.\+1 
\end{DoxySince}

\begin{DoxyParams}{Parameters}
{\em sender} & the new sender address \\
\hline
{\em params} & an optional list of E\+S\+M\+T\+P parameters \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if C\+H\+G\+F\+R\+O\+M is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!chgheader@{chgheader}}
\index{chgheader@{chgheader}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{chgheader}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+chgheader (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{field, }
\item[{}]{idx, }
\item[{}]{value}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a1a347409d4a5df7a885034d4cae04b56}


Change the value of a mail header field. 

Calls {\tt smfi\+\_\+chgheader}. The {\ttfamily Milter.\+C\+H\+G\+H\+D\+R\+S} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em field} & the name of the field to change \\
\hline
{\em idx} & index of the field to change when there are multiple instances \\
\hline
{\em value} & the new value of the field \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if C\+H\+G\+H\+D\+R\+S is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!close@{close}}
\index{close@{close}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+close (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a2644dc855f49da0a9810e8d390c93906}


Called when the connection is closed. 



Referenced by Milter.\+test.\+Test\+Base.\+connect().

\index{Milter\+::\+Base@{Milter\+::\+Base}!connect@{connect}}
\index{connect@{connect}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{connect}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+connect (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{hostname, }
\item[{}]{family, }
\item[{}]{hostaddr}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a6f851a653da04dde2a2f3bf115b8e279}


Called for each connection to the M\+T\+A. 

Called by the {\tt xxfi\+\_\+connect} callback. The {\ttfamily hostname} provided by the local M\+T\+A is either the P\+T\+R name or the I\+P in the form \char`\"{}[1.\+2.\+3.\+4]\char`\"{} if no P\+T\+R is available. The format of hostaddr depends on the socket family\+: 
\begin{DoxyDescription}
\item[{\ttfamily socket.\+A\+F\+\_\+\+I\+N\+E\+T} ]A tuple of (I\+P as string in dotted quad form, integer port) 
\item[{\ttfamily socket.\+A\+F\+\_\+\+I\+N\+E\+T6} ]A tuple of (I\+P as a string in standard representation, integer port, integer flow info, integer scope id) 
\item[{\ttfamily socket.\+A\+F\+\_\+\+U\+N\+I\+X} ]A string with the socketname 
\end{DoxyDescription}To vary behavior based on what port the client connected to, for example skipping blacklist checks for port 587 (which must be authenticated), use \doxyref{getsymval(\textquotesingle{}\{daemon\+\_\+port\}\textquotesingle{}) }{p.}{classMilter_1_1Base_ac5b454b632d5fe6a5f1157e44ec70920}. The {\ttfamily \{daemon\+\_\+port\}} macro must be enabled in sendmail.\+cf 
\begin{DoxyPre}
 O Milter.macros.connect=j, \_, \{daemon\_name\}, \{daemon\_port\}, \{if\_name\}, \{if\_addr\}
 \end{DoxyPre}
 or sendmail.\+mc 
\begin{DoxyPre}
 define(`confMILTER\_MACROS\_CONNECT', ``j, \_, \{daemon\_name\}, \{daemon\_port\}, \{if\_name\}, \{if\_addr\}'')dnl
 \end{DoxyPre}
 
\begin{DoxyParams}{Parameters}
{\em hostname} & the P\+T\+R name or bracketed I\+P of the S\+M\+T\+P client \\
\hline
{\em family} & {\ttfamily socket.\+A\+F\+\_\+\+I\+N\+E\+T}, {\ttfamily socket.\+A\+F\+\_\+\+I\+N\+E\+T6}, or {\ttfamily socket.\+A\+F\+\_\+\+U\+N\+I\+X} \\
\hline
{\em hostaddr} & a tuple or string with peer I\+P or socketname \\
\hline
\end{DoxyParams}
\index{Milter\+::\+Base@{Milter\+::\+Base}!data@{data}}
\index{data@{data}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{data}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+data (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_abf00ce24c390ab0a4a05d636fa998e44}


Called when the S\+M\+T\+P client says D\+A\+T\+A. 

Returning R\+E\+J\+E\+C\+T rejects the message without wasting bandwidth on the unwanted message. \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}
\index{Milter\+::\+Base@{Milter\+::\+Base}!delrcpt@{delrcpt}}
\index{delrcpt@{delrcpt}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{delrcpt}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+delrcpt (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{rcpt}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a74c8c1dc261266865905f228370cf835}


Delete a recipient from the message. 

Calls {\tt smfi\+\_\+delrcpt}. The recipient should match one passed to the envrcpt callback. The {\ttfamily Milter.\+D\+E\+L\+R\+C\+P\+T} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em rcpt} & the message recipient to delete \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if D\+E\+L\+R\+C\+P\+T is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!envfrom@{envfrom}}
\index{envfrom@{envfrom}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{envfrom}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+envfrom (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{f, }
\item[{}]{str}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_ac8f026580efbc83c4901693828a362f5}


Called when the S\+M\+T\+P client says M\+A\+I\+L F\+R\+O\+M. 

Called by the {\tt xxfi\+\_\+envfrom} callback. Returning R\+E\+J\+E\+C\+T rejects the message, but not the connection. The sender is the \char`\"{}envelope\char`\"{} from as defined by {\tt R\+F\+C 5321}. For the From\+: header (author) defined in {\tt R\+F\+C 5322}, see \doxyref{the header callback }{p.}{classMilter_1_1Base_a22df44f0417b6a538c80e709b5dbd9bb}. 

Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!envrcpt@{envrcpt}}
\index{envrcpt@{envrcpt}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{envrcpt}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+envrcpt (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{to, }
\item[{}]{str}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_acf659328d83d1e74e1712e61670ff551}


Called when the S\+M\+T\+P client says R\+C\+P\+T T\+O. 

Called by the {\tt xxfi\+\_\+envrcpt} callback. Returning R\+E\+J\+E\+C\+T rejects the current recipient, not the entire message. The recipient is the \char`\"{}envelope\char`\"{} recipient as defined by {\tt R\+F\+C 5321}. For recipients defined in {\tt R\+F\+C 5322}, for example To\+: or Cc\+:, see \doxyref{the header callback }{p.}{classMilter_1_1Base_a22df44f0417b6a538c80e709b5dbd9bb}. 

Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!eoh@{eoh}}
\index{eoh@{eoh}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{eoh}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+eoh (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a93670397eb663ef9bb9da4db2f9c514b}


Called at the blank line that terminates the header fields. 



Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!eom@{eom}}
\index{eom@{eom}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{eom}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+eom (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a725f845830639b76f479dc6c0f7f8c00}


Called at the end of the message body. 

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

Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!getsymval@{getsymval}}
\index{getsymval@{getsymval}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{getsymval}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+getsymval (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{sym}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_ac5b454b632d5fe6a5f1157e44ec70920}


Return the value of an M\+T\+A macro. 

Sendmail macro names are either single chars (e.\+g. \char`\"{}j\char`\"{}) or multiple chars enclosed in braces (e.\+g. \char`\"{}\{auth\+\_\+type\}\char`\"{}). Macro names are M\+T\+A dependent. See {\tt smfi\+\_\+getsymval} for default sendmail macros. 
\begin{DoxyParams}{Parameters}
{\em sym} & the macro name \\
\hline
\end{DoxyParams}
\index{Milter\+::\+Base@{Milter\+::\+Base}!header@{header}}
\index{header@{header}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{header}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+header (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{field, }
\item[{}]{value}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a22df44f0417b6a538c80e709b5dbd9bb}


Called for each header field in the message body. 



Referenced by Milter.\+test.\+Test\+Base.\+feed\+File().

\index{Milter\+::\+Base@{Milter\+::\+Base}!hello@{hello}}
\index{hello@{hello}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{hello}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+hello (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{hostname}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a5aa99b34a5b4a9cd220fd4d936bfb43b}


Called when the S\+M\+T\+P client says H\+E\+L\+O. 

Returning R\+E\+J\+E\+C\+T prevents progress until a valid H\+E\+L\+O is provided; this almost always results in terminating the connection. 

Referenced by Milter.\+test.\+Test\+Base.\+connect().

\index{Milter\+::\+Base@{Milter\+::\+Base}!log@{log}}
\index{log@{log}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{log}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+log (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{msg}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a47476b680e5ee291dac5a8f5646528d5}


Defined by subclasses to write log messages. 



Referenced by Milter.\+Milter.\+envfrom(), Milter.\+Milter.\+log(), and Milter.\+test.\+Test\+Base.\+setsymval().

\index{Milter\+::\+Base@{Milter\+::\+Base}!negotiate@{negotiate}}
\index{negotiate@{negotiate}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{negotiate}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+negotiate (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{opts}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_aeadc158feb217d3667266fb1ccf17398}


Negotiate milter protocol options. 

Called by the {\tt xffi\+\_\+negotiate} callback. This is an advanced callback, do not override unless you know what you are doing. Most negotiation can be done simply by using the supplied class and function decorators. Options are passed as a list of 4 32-\/bit ints which can be modified and are passed back to libmilter on return. Default negotiation sets P\+\_\+\+N\+O$\ast$ and P\+\_\+\+N\+R$\ast$ for callbacks marked @nocallback and @noreply respectively, leaves all actions enabled, and enables Milter.\+S\+K\+I\+P. The @enable\+\_\+protocols class decorator can customize which protocol steps are implemented. 
\begin{DoxyParams}{Parameters}
{\em opts} & a modifiable list of 4 ints with negotiated options \\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


References Milter.\+Base.\+\_\+actions, Milter.\+Base.\+\_\+protocol, and Milter.\+Base.\+protocol\+\_\+mask().



Referenced by Milter.\+test.\+Test\+Base.\+connect().

\index{Milter\+::\+Base@{Milter\+::\+Base}!progress@{progress}}
\index{progress@{progress}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{progress}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+progress (
\begin{DoxyParamCaption}
\item[{}]{self}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a205b0299e1522dc90b8f966ca45605b9}


Tell the M\+T\+A to wait a bit longer. 

Calls {\tt smfi\+\_\+progress}. Resets timeouts in the M\+T\+A that detect a \char`\"{}hung\char`\"{} milter. \index{Milter\+::\+Base@{Milter\+::\+Base}!protocol\+\_\+mask@{protocol\+\_\+mask}}
\index{protocol\+\_\+mask@{protocol\+\_\+mask}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{protocol\+\_\+mask}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+protocol\+\_\+mask (
\begin{DoxyParamCaption}
\item[{}]{klass}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_aac1122e063303641aa7fae68e4e85fce}


Return mask of S\+M\+F\+I\+P\+\_\+\+N$\ast$ protocol option bits to clear for this class The @nocallback and @noreply decorators set the {\ttfamily milter\+\_\+protocol} function attribute to the protocol mask bit to pass to libmilter, causing that callback or its reply to be skipped. 

Overriding a method creates a new function object, so that {\ttfamily milter\+\_\+protocol} defaults to 0. Libmilter passes the protocol bits that the current M\+T\+A knows how to skip. We clear the ones we don\textquotesingle{}t want to skip. The negation is somewhat mind bending, but it is simple. \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Referenced by Milter.\+Base.\+negotiate().

\index{Milter\+::\+Base@{Milter\+::\+Base}!quarantine@{quarantine}}
\index{quarantine@{quarantine}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{quarantine}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+quarantine (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{reason}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_ad13ec12846ef63c8d7f068a9734a3402}


Quarantine the message. 

Calls {\tt smfi\+\_\+quarantine}. When quarantined, a message goes into the mailq as if to be delivered, but delivery is deferred until the message is unquarantined. The {\ttfamily Milter.\+Q\+U\+A\+R\+A\+N\+T\+I\+N\+E} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em reason} & a string describing the reason for quarantine \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if Q\+U\+A\+R\+A\+N\+T\+I\+N\+E is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!replacebody@{replacebody}}
\index{replacebody@{replacebody}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{replacebody}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+replacebody (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{body}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a568fdb57a923406da9d1b6d314fbaf99}


Replace the message body. 

Calls {\tt smfi\+\_\+replacebody}. The entire message body must be replaced. Call repeatedly with blocks of data until the entire body is transferred. The {\ttfamily Milter.\+M\+O\+D\+B\+O\+D\+Y} action flag must be set.

May be called from eom callback only. 
\begin{DoxyParams}{Parameters}
{\em body} & a chunk of body data \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if M\+O\+D\+B\+O\+D\+Y is not enabled \\
\hline
\end{DoxyExceptions}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!setreply@{setreply}}
\index{setreply@{setreply}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{setreply}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+setreply (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{rcode, }
\item[{}]{xcode = {\ttfamily None}, }
\item[{}]{msg = {\ttfamily None}, }
\item[{}]{ml}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_acc5eb6a3a7e180c26f1d90f52b41dfeb}


Set the S\+M\+T\+P reply code and message. 

If the M\+T\+A does not support setmlreply, then only the first msg line is used. Any \textquotesingle{}\%\textquotesingle{} in a message line must be doubled, or libmilter will silently ignore the setreply. Beginning with 0.\+9.\+6, we test for that case and throw Value\+Error to avoid head scratching. What will {\itshape really} irritate you, however, is that if you carefully double any \textquotesingle{}\%\textquotesingle{}, your message will be sent -\/ but with the \textquotesingle{}\%\textquotesingle{} still doubled! See {\tt smfi\+\_\+setreply} for more information. 
\begin{DoxyParams}{Parameters}
{\em rcode} & The three-\/digit (R\+F\+C 821/2821) S\+M\+T\+P reply code as a string. rcode cannot be None, and {\bfseries must be a valid 4\+X\+X or 5\+X\+X reply code}. \\
\hline
{\em xcode} & The extended (R\+F\+C 1893/2034) reply code. If xcode is None, no extended code is used. Otherwise, xcode must conform to R\+F\+C 1893/2034. \\
\hline
{\em msg} & The text part of the S\+M\+T\+P reply. If msg is None, an empty message is used. \\
\hline
{\em ml} & Optional additional message lines. \\
\hline
\end{DoxyParams}
\index{Milter\+::\+Base@{Milter\+::\+Base}!setsymlist@{setsymlist}}
\index{setsymlist@{setsymlist}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{setsymlist}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+setsymlist (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{stage, }
\item[{}]{macros}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_a4d13ccd11154f91f1baac018d24f0985}


Tell the M\+T\+A which macro names will be used. 

This information can reduce the size of messages received from sendmail, and hence could reduce bandwidth between sendmail and your milter where that is a factor. The {\ttfamily Milter.\+S\+E\+T\+S\+Y\+M\+L\+I\+S\+T} action flag must be set. The protocol stages are M\+\_\+\+C\+O\+N\+N\+E\+C\+T, M\+\_\+\+H\+E\+L\+O, M\+\_\+\+E\+N\+V\+F\+R\+O\+M, M\+\_\+\+E\+N\+V\+R\+C\+P\+T, M\+\_\+\+D\+A\+T\+A, M\+\_\+\+E\+O\+M, M\+\_\+\+E\+O\+H.

May only be called from negotiate callback. \begin{DoxySince}{Since}
0.\+9.\+8, previous version was misspelled! 
\end{DoxySince}

\begin{DoxyParams}{Parameters}
{\em stage} & the protocol stage to set to macro list for, one of the M\+\_\+$\ast$ constants defined in \doxyref{Milter}{p.}{classMilter_1_1Milter} \\
\hline
{\em macros} & space separated and/or lists of strings \\
\hline
\end{DoxyParams}


References Milter.\+Base.\+\_\+actions.

\index{Milter\+::\+Base@{Milter\+::\+Base}!unknown@{unknown}}
\index{unknown@{unknown}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{unknown}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+Base.\+unknown (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{cmd}
\end{DoxyParamCaption}
)}\label{classMilter_1_1Base_ac5f378191774345521af24d1ca38292e}


Called when the S\+M\+T\+P client issues an unknown command. 


\begin{DoxyParams}{Parameters}
{\em cmd} & the unknown command \\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


\subsection{Member Data Documentation}
\index{Milter\+::\+Base@{Milter\+::\+Base}!\+\_\+actions@{\+\_\+actions}}
\index{\+\_\+actions@{\+\_\+actions}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{\+\_\+actions}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+Base.\+\_\+actions\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1Base_ab811ed56bfbedac527f0c7edf59d49b9}


A bitmask of actions this connection has negotiated to use. 

By default, all actions are enabled. High throughput milters may want to disable unused actions to increase efficiency. Some optional actions may be disabled by calling \doxyref{milter.\+set\+\_\+flags()}{p.}{namespacemilter_afe0230448acb391b264e8b5c28d45c3c}, or by overriding the negotiate callback. The bits include\+: {\ttfamily A\+D\+D\+H\+D\+R\+S,C\+H\+G\+B\+O\+D\+Y,M\+O\+D\+B\+O\+D\+Y,A\+D\+D\+R\+C\+P\+T,A\+D\+D\+R\+C\+P\+T\+\_\+\+P\+A\+R,D\+E\+L\+R\+C\+P\+T C\+H\+G\+H\+D\+R\+S,Q\+U\+A\+R\+A\+N\+T\+I\+N\+E,C\+H\+G\+F\+R\+O\+M,S\+E\+T\+S\+Y\+M\+L\+I\+S\+T}. The {\ttfamily Milter.\+C\+U\+R\+R\+\_\+\+A\+C\+T\+S} bitmask is all actions known when the milter module was compiled. Application code can also inspect this field to determine which actions are available. This is especially useful in generic library code designed to work in multiple milters. \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Referenced by Milter.\+Base.\+addheader(), Milter.\+Base.\+addrcpt(), Milter.\+Base.\+chgfrom(), Milter.\+Base.\+chgheader(), Milter.\+Base.\+delrcpt(), Milter.\+Base.\+negotiate(), Milter.\+Base.\+quarantine(), Milter.\+Base.\+replacebody(), Milter.\+test.\+Test\+Base.\+setreply(), and Milter.\+Base.\+setsymlist().

\index{Milter\+::\+Base@{Milter\+::\+Base}!\+\_\+ctx@{\+\_\+ctx}}
\index{\+\_\+ctx@{\+\_\+ctx}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{\+\_\+ctx}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+Base.\+\_\+ctx\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1Base_a9b0c1dfc1de626de061cfa04a481d08c}


The low level \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} object. 

\index{Milter\+::\+Base@{Milter\+::\+Base}!\+\_\+protocol@{\+\_\+protocol}}
\index{\+\_\+protocol@{\+\_\+protocol}!Milter\+::\+Base@{Milter\+::\+Base}}
\subsubsection[{\+\_\+protocol}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+Base.\+\_\+protocol\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1Base_a2b029cd0e1e8a56340a09cb64425f024}


A bitmask of protocol options this connection has negotiated. 

An application may inspect this variable to determine which protocol steps are supported. Options of interest to applications\+: the S\+K\+I\+P result code is allowed only if the P\+\_\+\+S\+K\+I\+P bit is set, rejected recipients are passed to the milter application only if the P\+\_\+\+R\+C\+P\+T\+\_\+\+R\+E\+J bit is set, and header values are sent and received with leading spaces (in the continuation lines) intact if the P\+\_\+\+H\+D\+R\+\_\+\+L\+E\+A\+D\+S\+P\+C bit is set (so that the application can customize indenting).

The P\+\_\+\+N$\ast$ bits should be negotiated via the @noreply and @nocallback method decorators, and P\+\_\+\+R\+C\+P\+T\+\_\+\+R\+E\+J, P\+\_\+\+H\+D\+R\+\_\+\+L\+E\+A\+D\+S\+P\+C should be enabled using the enable\+\_\+protocols class decorator.

The bits include\+: {\ttfamily  P\+\_\+\+R\+C\+P\+T\+\_\+\+R\+E\+J P\+\_\+\+N\+R\+\_\+\+C\+O\+N\+N P\+\_\+\+N\+R\+\_\+\+H\+E\+L\+O P\+\_\+\+N\+R\+\_\+\+M\+A\+I\+L P\+\_\+\+N\+R\+\_\+\+R\+C\+P\+T P\+\_\+\+N\+R\+\_\+\+D\+A\+T\+A P\+\_\+\+N\+R\+\_\+\+U\+N\+K\+N P\+\_\+\+N\+R\+\_\+\+E\+O\+H P\+\_\+\+N\+R\+\_\+\+B\+O\+D\+Y P\+\_\+\+N\+R\+\_\+\+H\+D\+R P\+\_\+\+N\+O\+C\+O\+N\+N\+E\+C\+T P\+\_\+\+N\+O\+H\+E\+L\+O P\+\_\+\+N\+O\+M\+A\+I\+L P\+\_\+\+N\+O\+R\+C\+P\+T P\+\_\+\+N\+O\+D\+A\+T\+A P\+\_\+\+N\+O\+U\+N\+K\+N\+O\+W\+N P\+\_\+\+N\+O\+E\+O\+H P\+\_\+\+N\+O\+B\+O\+D\+Y P\+\_\+\+N\+O\+H\+D\+R\+S P\+\_\+\+H\+D\+R\+\_\+\+L\+E\+A\+D\+S\+P\+C P\+\_\+\+S\+K\+I\+P } (all under the \doxyref{Milter}{p.}{classMilter_1_1Milter} namespace). \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Referenced by Milter.\+Base.\+negotiate().



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
Milter/\+\_\+\+\_\+init\+\_\+\+\_\+.\+py\end{DoxyCompactItemize}
