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


A do "{}nothing"{} \doxyref{Milter}{p.}{classMilter_1_1Milter} base class representing an SMTP connection.  


Inheritance diagram for Milter.\+Base\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classMilter_1_1Base}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ log} (self, $\ast$msg)
\begin{DoxyCompactList}\small\item\em Defined by subclasses to write log messages. \end{DoxyCompactList}\item 
\textbf{ connect} (self, hostname, family, hostaddr)
\begin{DoxyCompactList}\small\item\em Called for each connection to the MTA. \end{DoxyCompactList}\item 
\textbf{ hello} (self, hostname)
\begin{DoxyCompactList}\small\item\em Called when the SMTP client says HELO. \end{DoxyCompactList}\item 
\textbf{ envfrom\+\_\+bytes} (self, $\ast$b)
\begin{DoxyCompactList}\small\item\em Called with bytes by default global envfrom callback. \end{DoxyCompactList}\item 
\textbf{ envfrom} (self, f, $\ast$s)
\begin{DoxyCompactList}\small\item\em Called when the SMTP client says MAIL FROM. \end{DoxyCompactList}\item 
\textbf{ envrcpt\+\_\+bytes} (self, $\ast$b)
\begin{DoxyCompactList}\small\item\em Called with bytes by default global envrcpt callback. \end{DoxyCompactList}\item 
\textbf{ envrcpt} (self, to, $\ast$str)
\begin{DoxyCompactList}\small\item\em Called when the SMTP client says RCPT TO. \end{DoxyCompactList}\item 
\textbf{ data} (self)
\begin{DoxyCompactList}\small\item\em Called when the SMTP client says DATA. \end{DoxyCompactList}\item 
\textbf{ header\+\_\+bytes} (self, fld, val)
\begin{DoxyCompactList}\small\item\em Called with bytes by default global header callback. \end{DoxyCompactList}\item 
\textbf{ header} (self, field, value)
\begin{DoxyCompactList}\small\item\em Called for each header field in the message body. \end{DoxyCompactList}\item 
\textbf{ eoh} (self)
\begin{DoxyCompactList}\small\item\em Called at the blank line that terminates the header fields. \end{DoxyCompactList}\item 
\textbf{ 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 
\textbf{ unknown} (self, cmd)
\begin{DoxyCompactList}\small\item\em Called when the SMTP client issues an unknown command. \end{DoxyCompactList}\item 
\textbf{ eom} (self)
\begin{DoxyCompactList}\small\item\em Called at the end of the message body. \end{DoxyCompactList}\item 
\textbf{ abort} (self)
\begin{DoxyCompactList}\small\item\em Called when the connection is abnormally terminated. \end{DoxyCompactList}\item 
\textbf{ close} (self)
\begin{DoxyCompactList}\small\item\em Called when the connection is closed. \end{DoxyCompactList}\item 
\textbf{ protocol\+\_\+mask} (klass)
\begin{DoxyCompactList}\small\item\em Return mask of SMFIP\+\_\+\+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 
\textbf{ negotiate} (self, opts)
\begin{DoxyCompactList}\small\item\em Negotiate milter protocol options. \end{DoxyCompactList}\item 
\textbf{ getsymval} (self, sym)
\begin{DoxyCompactList}\small\item\em Return the value of an MTA macro. \end{DoxyCompactList}\item 
\textbf{ setreply} (self, rcode, xcode=None, msg=None, $\ast$ml)
\begin{DoxyCompactList}\small\item\em Set the SMTP reply code and message. \end{DoxyCompactList}\item 
\textbf{ setsymlist} (self, stage, $\ast$macros)
\begin{DoxyCompactList}\small\item\em Tell the MTA which macro names will be used. \end{DoxyCompactList}\item 
\textbf{ addheader} (self, field, value, idx=-\/1)
\begin{DoxyCompactList}\small\item\em Add a mail header field. \end{DoxyCompactList}\item 
\textbf{ chgheader} (self, field, idx, value)
\begin{DoxyCompactList}\small\item\em Change the value of a mail header field. \end{DoxyCompactList}\item 
\textbf{ addrcpt} (self, rcpt, params=None)
\begin{DoxyCompactList}\small\item\em Add a recipient to the message. \end{DoxyCompactList}\item 
\textbf{ delrcpt} (self, rcpt)
\begin{DoxyCompactList}\small\item\em Delete a recipient from the message. \end{DoxyCompactList}\item 
\textbf{ replacebody} (self, \textbf{ body})
\begin{DoxyCompactList}\small\item\em Replace the message body. \end{DoxyCompactList}\item 
\textbf{ chgfrom} (self, sender, params=None)
\begin{DoxyCompactList}\small\item\em Change the SMTP envelope sender address. \end{DoxyCompactList}\item 
\textbf{ quarantine} (self, reason)
\begin{DoxyCompactList}\small\item\em Quarantine the message. \end{DoxyCompactList}\item 
\textbf{ progress} (self)
\begin{DoxyCompactList}\small\item\em Tell the MTA to wait a bit longer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1Base_a080c4ba4fe6854d4414743ef3afdb966} 
{\bfseries header\+\_\+bytes} = self.\+header
\end{DoxyCompactItemize}
\doxysubsubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1Base_a2bb94ae9f2dd886171ae14a6fc31777c} 
{\bfseries \+\_\+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}
\doxysubsubsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1Base_a9b0c1dfc1de626de061cfa04a481d08c} 
{\bfseries \+\_\+ctx} = ctx
\begin{DoxyCompactList}\small\item\em The low level \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} object. \end{DoxyCompactList}\item 
\textbf{ \+\_\+actions} = CURR\+\_\+\+ACTS
\begin{DoxyCompactList}\small\item\em A bitmask of actions this connection has negotiated to use. \end{DoxyCompactList}\item 
int \textbf{ \+\_\+protocol} = 0
\begin{DoxyCompactList}\small\item\em A bitmask of protocol options this connection has negotiated. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
A do "{}nothing"{} \doxyref{Milter}{p.}{classMilter_1_1Milter} base class representing an SMTP connection. 

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


Most of the methods are either "{}actions"{} or "{}callbacks"{}. Callbacks are invoked by the MTA at certain points in the SMTP protocol. For instance when the HELO command is seen, the MTA calls the helo callback before returning a response code. All callbacks must return one of these constants\+: CONTINUE, TEMPFAIL, REJECT, ACCEPT, DISCARD, SKIP. The NOREPLY response is supplied automatically by the @noreply decorator if negotiation with the MTA is successful. @noreply and @nocallback methods should return CONTINUE for two reasons\+: the MTA 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 CONTINUE for testing and MTAs that do not support negotiation. 

\label{doc-func-members}
\doxysubsection{Member Function Documentation}
\index{Milter.Base@{Milter.Base}!abort@{abort}}
\index{abort@{abort}!Milter.Base@{Milter.Base}}
\doxysubsubsection{abort()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_aab89532d73c7885543bd45dccc986f6e} 
Milter.\+Base.\+abort (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Called when the connection is abnormally terminated. 

The close callback is still called also. 

Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a3e79621ce95c568d96b2d0a2f069a7dc}.

\index{Milter.Base@{Milter.Base}!addheader@{addheader}}
\index{addheader@{addheader}!Milter.Base@{Milter.Base}}
\doxysubsubsection{addheader()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a9222f2d8db43bc2d42b0c662899515f6} 
Milter.\+Base.\+addheader (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{field}{, }\item[{}]{value}{, }\item[{}]{idx}{ = {\ttfamily -\/1}}\end{DoxyParamCaption})}



Add a mail header field. 

Calls {\texttt{smfi\+\_\+addheader}}. ~\newline
 The {\ttfamily Milter.\+ADDHDRS} 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 ADDHDRS is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ addheader()}.



Referenced by \textbf{ addheader()}.

\index{Milter.Base@{Milter.Base}!addrcpt@{addrcpt}}
\index{addrcpt@{addrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{addrcpt()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a3d41dd8792f9a1c28ed9d7ce924ef02e} 
Milter.\+Base.\+addrcpt (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{rcpt}{, }\item[{}]{params}{ = {\ttfamily None}}\end{DoxyParamCaption})}



Add a recipient to the message. 

~\newline
 Calls {\texttt{smfi\+\_\+addrcpt}}. ~\newline
 If no corresponding mail header is added, this is like a Bcc. The syntax of the recipient is the same as used in the SMTP RCPT TO command (and as delivered to the envrcpt callback), for example "{}self.\+addrcpt(\textquotesingle{}$<$foo@example.\+com$>$\textquotesingle{})"{}. ~\newline
 The {\ttfamily Milter.\+ADDRCPT} action flag must be set. If the optional {\ttfamily params} argument is used, then the {\ttfamily Milter.\+ADDRCPT\+\_\+\+PAR} 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 ESMTP parameters \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if ADDRCPT or ADDRCPT\+\_\+\+PAR is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ addrcpt()}.



Referenced by \textbf{ addrcpt()}.

\index{Milter.Base@{Milter.Base}!body@{body}}
\index{body@{body}!Milter.Base@{Milter.Base}}
\doxysubsubsection{body()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ac753a2ed31264d61168d169668f60149} 
Milter.\+Base.\+body (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{blk}{}\end{DoxyParamCaption})}



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 \textbf{ Milter.\+test.\+Test\+Base.\+feed\+File()}.

\index{Milter.Base@{Milter.Base}!chgfrom@{chgfrom}}
\index{chgfrom@{chgfrom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{chgfrom()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ad67203d5c83d4ee88b3230760d8484d0} 
Milter.\+Base.\+chgfrom (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{sender}{, }\item[{}]{params}{ = {\ttfamily None}}\end{DoxyParamCaption})}



Change the SMTP envelope sender address. 

Calls {\texttt{smfi\+\_\+chgfrom}}. ~\newline
 The syntax of the sender is that same as used in the SMTP MAIL FROM command (and as delivered to the envfrom callback), for example {\ttfamily self.\+chgfrom(\textquotesingle{}{\texttt{bar@example.\+com}}\textquotesingle{})}. The {\ttfamily Milter.\+CHGFROM} 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 ESMTP parameters \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \doxyref{Disabled\+Action}{p.}{classMilter_1_1DisabledAction}} & if CHGFROM is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ chgfrom()}.



Referenced by \textbf{ chgfrom()}.

\index{Milter.Base@{Milter.Base}!chgheader@{chgheader}}
\index{chgheader@{chgheader}!Milter.Base@{Milter.Base}}
\doxysubsubsection{chgheader()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a72fec823b68f380a10f9a442a56abcf8} 
Milter.\+Base.\+chgheader (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{field}{, }\item[{}]{idx}{, }\item[{}]{value}{}\end{DoxyParamCaption})}



Change the value of a mail header field. 

Calls {\texttt{smfi\+\_\+chgheader}}. ~\newline
 The {\ttfamily Milter.\+CHGHDRS} 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 CHGHDRS is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ chgheader()}.



Referenced by \textbf{ chgheader()}.

\index{Milter.Base@{Milter.Base}!close@{close}}
\index{close@{close}!Milter.Base@{Milter.Base}}
\doxysubsubsection{close()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a913c7c4adfae301e053346706d8eb284} 
Milter.\+Base.\+close (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Called when the connection is closed. 



Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a3dc0fcc9714f70f08c9aad9ce3a5641d}.



Referenced by \textbf{ Milter.\+test.\+Test\+Base.\+connect()}, and \textbf{ Milter.\+test.\+Test\+Base.\+feed\+File()}.

\index{Milter.Base@{Milter.Base}!connect@{connect}}
\index{connect@{connect}!Milter.Base@{Milter.Base}}
\doxysubsubsection{connect()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_aaf80d7ebbb7b303cba11b65c24107ab8} 
Milter.\+Base.\+connect (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{hostname}{, }\item[{}]{family}{, }\item[{}]{hostaddr}{}\end{DoxyParamCaption})}



Called for each connection to the MTA. 

Called by the {\texttt{xxfi\+\_\+connect}} callback. ~\newline
 The {\ttfamily 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\+: 
\begin{DoxyDescription}
\item[{\parbox[t]{\linewidth}{{\ttfamily socket.\+AF\+\_\+\+INET} }}]\hfill \\
A tuple of (IP as string in dotted quad form, integer port) 
\item[{\parbox[t]{\linewidth}{{\ttfamily socket.\+AF\+\_\+\+INET6} }}]\hfill \\
A tuple of (IP as a string in standard representation, integer port, integer flow info, integer scope id) 
\item[{\parbox[t]{\linewidth}{{\ttfamily socket.\+AF\+\_\+\+UNIX} }}]\hfill \\
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_a81a2c7315c6fdc90ef0b6de5b5624289}. 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 PTR name or bracketed IP of the SMTP client \\
\hline
{\em family} & {\ttfamily socket.\+AF\+\_\+\+INET}, {\ttfamily socket.\+AF\+\_\+\+INET6}, or {\ttfamily socket.\+AF\+\_\+\+UNIX} \\
\hline
{\em hostaddr} & a tuple or string with peer IP or socketname \\
\hline
\end{DoxyParams}


Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a3cc2e8d93c9a588a884f4cbe9a484511}.

\index{Milter.Base@{Milter.Base}!data@{data}}
\index{data@{data}!Milter.Base@{Milter.Base}}
\doxysubsubsection{data()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_af991d400ea8880184cee182c22c0a025} 
Milter.\+Base.\+data (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Called when the SMTP client says DATA. 

Returning REJECT rejects the message without wasting bandwidth on the unwanted message. \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


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

\index{Milter.Base@{Milter.Base}!delrcpt@{delrcpt}}
\index{delrcpt@{delrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{delrcpt()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a3a66ab1a9ecb938a985bb3d29a80986d} 
Milter.\+Base.\+delrcpt (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{rcpt}{}\end{DoxyParamCaption})}



Delete a recipient from the message. 

Calls {\texttt{smfi\+\_\+delrcpt}}. ~\newline
 The recipient should match one passed to the envrcpt callback. The {\ttfamily Milter.\+DELRCPT} 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 DELRCPT is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ delrcpt()}.



Referenced by \textbf{ delrcpt()}.

\index{Milter.Base@{Milter.Base}!envfrom@{envfrom}}
\index{envfrom@{envfrom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envfrom()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_abf3a0558e5717751bec412e051509e59} 
Milter.\+Base.\+envfrom (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{f}{, }\item[{$\ast$}]{s}{}\end{DoxyParamCaption})}



Called when the SMTP client says MAIL FROM. 

Called by the {\texttt{xxfi\+\_\+envfrom}} callback. ~\newline
 Returning REJECT rejects the message, but not the connection. The sender is the "{}envelope"{} from as defined by {\texttt{RFC 5321}}. For the From\+: header (author) defined in {\texttt{RFC 5322}}, see \doxyref{the header callback }{p.}{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d}. 

Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a5038ba891e9192a29466c18157cfcb07}.



Referenced by \textbf{ envfrom\+\_\+bytes()}, and \textbf{ Milter.\+test.\+Test\+Base.\+feed\+File()}.

\index{Milter.Base@{Milter.Base}!envfrom\_bytes@{envfrom\_bytes}}
\index{envfrom\_bytes@{envfrom\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envfrom\_bytes()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a5ec1986ecec2b87805e853c6734cfd39} 
Milter.\+Base.\+envfrom\+\_\+bytes (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{$\ast$}]{b}{}\end{DoxyParamCaption})}



Called with bytes by default global envfrom callback. 

\begin{DoxySince}{Since}
1.\+0.\+5 Converts from utf-\/8 to unicode with surrogate escape. Can be overriden to pass bytes to \doxyref{the header callback }{p.}{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d} instead, or trap utf-\/8 conversion exception, etc. 
\end{DoxySince}


References \textbf{ envfrom()}.

\index{Milter.Base@{Milter.Base}!envrcpt@{envrcpt}}
\index{envrcpt@{envrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envrcpt()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ad9cd474774bd9064321a969c10b4aea7} 
Milter.\+Base.\+envrcpt (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{to}{, }\item[{$\ast$}]{str}{}\end{DoxyParamCaption})}



Called when the SMTP client says RCPT TO. 

Called by the {\texttt{xxfi\+\_\+envrcpt}} callback. Returning REJECT rejects the current recipient, not the entire message. The recipient is the "{}envelope"{} recipient as defined by {\texttt{RFC 5321}}. For recipients defined in {\texttt{RFC 5322}}, for example To\+: or Cc\+:, see \doxyref{the header callback }{p.}{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d}. 

Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_ac087e282180591448ff33fef4dd8837e}.



Referenced by \textbf{ envrcpt\+\_\+bytes()}, and \textbf{ Milter.\+test.\+Test\+Base.\+feed\+File()}.

\index{Milter.Base@{Milter.Base}!envrcpt\_bytes@{envrcpt\_bytes}}
\index{envrcpt\_bytes@{envrcpt\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envrcpt\_bytes()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_af14a7f66f2c65bc3761396859909e094} 
Milter.\+Base.\+envrcpt\+\_\+bytes (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{$\ast$}]{b}{}\end{DoxyParamCaption})}



Called with bytes by default global envrcpt callback. 

\begin{DoxySince}{Since}
1.\+0.\+5 Converts from utf-\/8 to unicode with surrogate escape. Can be overriden to pass bytes to \doxyref{the header callback }{p.}{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d} instead, or trap utf-\/8 conversion exception, etc. 
\end{DoxySince}


References \textbf{ envrcpt()}.

\index{Milter.Base@{Milter.Base}!eoh@{eoh}}
\index{eoh@{eoh}!Milter.Base@{Milter.Base}}
\doxysubsubsection{eoh()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a5ef237b45d7b9951af7fac346f395d5a} 
Milter.\+Base.\+eoh (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Called at the blank line that terminates the header fields. 



Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_aba25c009eb20d40f33e28a30cdb26a44}.



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

\index{Milter.Base@{Milter.Base}!eom@{eom}}
\index{eom@{eom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{eom()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a833dd03e53009283470cd19081a1dff7} 
Milter.\+Base.\+eom (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Called at the end of the message body. 

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

Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a9c377e92223578e59462c36701525568}.



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

\index{Milter.Base@{Milter.Base}!getsymval@{getsymval}}
\index{getsymval@{getsymval}!Milter.Base@{Milter.Base}}
\doxysubsubsection{getsymval()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a81a2c7315c6fdc90ef0b6de5b5624289} 
Milter.\+Base.\+getsymval (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{sym}{}\end{DoxyParamCaption})}



Return the value of an MTA macro. 

Sendmail macro names are either single chars (e.\+g. "{}j"{}) or multiple chars enclosed in braces (e.\+g. "{}\{auth\+\_\+type\}"{}). Macro names are MTA dependent. See {\texttt{smfi\+\_\+getsymval}} for default sendmail macros. 
\begin{DoxyParams}{Parameters}
{\em sym} & the macro name \\
\hline
\end{DoxyParams}


References \textbf{ \+\_\+ctx}, and \textbf{ getsymval()}.



Referenced by \textbf{ getsymval()}.

\index{Milter.Base@{Milter.Base}!header@{header}}
\index{header@{header}!Milter.Base@{Milter.Base}}
\doxysubsubsection{header()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d} 
Milter.\+Base.\+header (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{field}{, }\item[{}]{value}{}\end{DoxyParamCaption})}



Called for each header field in the message body. 


\begin{DoxyParams}{Parameters}
{\em field} & name decoded as ascii \\
\hline
{\em value} & field value decoded as utf-\/8 on python3 \\
\hline
\end{DoxyParams}


Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a6cef34387599e7575c0f59d5dbf18ee5}.



Referenced by \textbf{ header\+\_\+bytes()}.

\index{Milter.Base@{Milter.Base}!header\_bytes@{header\_bytes}}
\index{header\_bytes@{header\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{header\_bytes()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a2dbec4c9e7cc9e2f06b6947ad368fcfc} 
Milter.\+Base.\+header\+\_\+bytes (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{fld}{, }\item[{}]{val}{}\end{DoxyParamCaption})}



Called with bytes by default global header callback. 


\begin{DoxyParams}{Parameters}
{\em fld} & name decoded as ascii \\
\hline
{\em val} & field value as bytes \\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\+0.\+5 Converts from utf-\/8 to unicode with surrogate escape. Can be overriden to pass bytes to \doxyref{the header callback }{p.}{classMilter_1_1Base_a4f2fab2af71f80cd2b6241a74929bb4d} instead, e.\+g. by assignment\+: 
\begin{DoxyPre}
 mymilter.header\_bytes = mymilter.header
\end{DoxyPre}
 The {\ttfamily @decode(\textquotesingle{}bytes\textquotesingle{})} decorator will also do this. 
\end{DoxySince}


References \textbf{ header()}, and header\+\_\+bytes.



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

\index{Milter.Base@{Milter.Base}!hello@{hello}}
\index{hello@{hello}!Milter.Base@{Milter.Base}}
\doxysubsubsection{hello()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_add1549d448dca956dcfbb66214a55252} 
Milter.\+Base.\+hello (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{hostname}{}\end{DoxyParamCaption})}



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 in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a37a60cb18cb4beb640e8343473745582}.



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

\index{Milter.Base@{Milter.Base}!log@{log}}
\index{log@{log}!Milter.Base@{Milter.Base}}
\doxysubsubsection{log()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_adb59df233502e18dcd2a226f00741710} 
Milter.\+Base.\+log (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{$\ast$}]{msg}{}\end{DoxyParamCaption})}



Defined by subclasses to write log messages. 



Reimplemented in \textbf{ Milter.\+Milter} \doxyref{}{p.}{classMilter_1_1Milter_a7267e75f0bc34a3f32a451156fd2fd2e}.



Referenced by \textbf{ Milter.\+Milter.\+abort()}, \textbf{ Milter.\+Milter.\+close()}, \textbf{ Milter.\+Milter.\+connect()}, \textbf{ Milter.\+Milter.\+envfrom()}, \textbf{ Milter.\+Milter.\+envrcpt()}, \textbf{ Milter.\+Milter.\+eoh()}, \textbf{ Milter.\+Milter.\+eom()}, \textbf{ Milter.\+Milter.\+header()}, \textbf{ Milter.\+Milter.\+hello()}, and \textbf{ Milter.\+test.\+Test\+Base.\+setsymval()}.

\index{Milter.Base@{Milter.Base}!negotiate@{negotiate}}
\index{negotiate@{negotiate}!Milter.Base@{Milter.Base}}
\doxysubsubsection{negotiate()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a80cb02ce99235d41b2181c430f0cd3c4} 
Milter.\+Base.\+negotiate (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{opts}{}\end{DoxyParamCaption})}



Negotiate milter protocol options. 

Called by the {\texttt{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\+\_\+\+NO$\ast$ and P\+\_\+\+NR$\ast$ for callbacks marked @nocallback and @noreply respectively, leaves all actions enabled, and enables \doxyref{Milter.\+SKIP}{p.}{namespacemilter_aa2fa23a83f9bbc204eb14313a6efd4cc}. 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 \textbf{ \+\_\+actions}, \textbf{ \+\_\+protocol}, \textbf{ protocol\+\_\+mask()}, \textbf{ setsymlist()}, and \textbf{ milter.\+milter\+Context.\+setsymlist()}.



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

\index{Milter.Base@{Milter.Base}!progress@{progress}}
\index{progress@{progress}!Milter.Base@{Milter.Base}}
\doxysubsubsection{progress()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a61076e4a426ab126a682402fe29297e4} 
Milter.\+Base.\+progress (\begin{DoxyParamCaption}\item[{}]{self}{}\end{DoxyParamCaption})}



Tell the MTA to wait a bit longer. 

Calls {\texttt{smfi\+\_\+progress}}. ~\newline
 Resets timeouts in the MTA that detect a "{}hung"{} milter. 

References \textbf{ \+\_\+ctx}, and \textbf{ progress()}.



Referenced by \textbf{ progress()}.

\index{Milter.Base@{Milter.Base}!protocol\_mask@{protocol\_mask}}
\index{protocol\_mask@{protocol\_mask}!Milter.Base@{Milter.Base}}
\doxysubsubsection{protocol\_mask()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a0de7f8f8c850d2b332acb316abd7cbb6} 
Milter.\+Base.\+protocol\+\_\+mask (\begin{DoxyParamCaption}\item[{}]{klass}{}\end{DoxyParamCaption})}



Return mask of SMFIP\+\_\+\+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 MTA 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 \textbf{ negotiate()}.

\index{Milter.Base@{Milter.Base}!quarantine@{quarantine}}
\index{quarantine@{quarantine}!Milter.Base@{Milter.Base}}
\doxysubsubsection{quarantine()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a3326c991fecc19aab97f992665941dff} 
Milter.\+Base.\+quarantine (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{reason}{}\end{DoxyParamCaption})}



Quarantine the message. 

Calls {\texttt{smfi\+\_\+quarantine}}. ~\newline
 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.\+QUARANTINE} 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 QUARANTINE is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ quarantine()}.



Referenced by \textbf{ quarantine()}.

\index{Milter.Base@{Milter.Base}!replacebody@{replacebody}}
\index{replacebody@{replacebody}!Milter.Base@{Milter.Base}}
\doxysubsubsection{replacebody()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ad59cb6693db26812015f9022d2364e0b} 
Milter.\+Base.\+replacebody (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{body}{}\end{DoxyParamCaption})}



Replace the message body. 

Calls {\texttt{smfi\+\_\+replacebody}}. ~\newline
 The entire message body must be replaced. ~\newline
 Call repeatedly with blocks of data until the entire body is transferred. The {\ttfamily Milter.\+MODBODY} 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 MODBODY is not enabled \\
\hline
\end{DoxyExceptions}


References \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ replacebody()}.



Referenced by \textbf{ replacebody()}.

\index{Milter.Base@{Milter.Base}!setreply@{setreply}}
\index{setreply@{setreply}!Milter.Base@{Milter.Base}}
\doxysubsubsection{setreply()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ab6b09c71e5035c3e60eee205e7efbc42} 
Milter.\+Base.\+setreply (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{rcode}{, }\item[{}]{xcode}{ = {\ttfamily None}, }\item[{}]{msg}{ = {\ttfamily None}, }\item[{$\ast$}]{ml}{}\end{DoxyParamCaption})}



Set the SMTP reply code and message. 

If the MTA 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 {\texttt{smfi\+\_\+setreply}} for more information. 
\begin{DoxyParams}{Parameters}
{\em rcode} & The three-\/digit (RFC 821/2821) SMTP reply code as a string. rcode cannot be None, and {\bfseries{must be a valid 4XX or 5XX reply code}}. \\
\hline
{\em xcode} & The extended (RFC 1893/2034) reply code. If xcode is None, no extended code is used. Otherwise, xcode must conform to RFC 1893/2034. \\
\hline
{\em msg} & The text part of the SMTP reply. If msg is None, an empty message is used. \\
\hline
{\em ml} & Optional additional message lines. \\
\hline
\end{DoxyParams}


References \textbf{ \+\_\+ctx}, and \textbf{ setreply()}.



Referenced by \textbf{ setreply()}.

\index{Milter.Base@{Milter.Base}!setsymlist@{setsymlist}}
\index{setsymlist@{setsymlist}!Milter.Base@{Milter.Base}}
\doxysubsubsection{setsymlist()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a33c4fa355c01db64a6a51e63cc86d81e} 
Milter.\+Base.\+setsymlist (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{stage}{, }\item[{$\ast$}]{macros}{}\end{DoxyParamCaption})}



Tell the MTA 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.\+SETSYMLIST} action flag must be set. The protocol stages are M\+\_\+\+CONNECT, M\+\_\+\+HELO, M\+\_\+\+ENVFROM, M\+\_\+\+ENVRCPT, M\+\_\+\+DATA, M\+\_\+\+EOM, M\+\_\+\+EOH.

May only be called from negotiate callback. Hence, this is an advanced feature. Use the @symlist function decorator to conviently set the macros used by a 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 \textbf{ \+\_\+actions}, \textbf{ \+\_\+ctx}, and \textbf{ setsymlist()}.



Referenced by \textbf{ negotiate()}, and \textbf{ setsymlist()}.

\index{Milter.Base@{Milter.Base}!unknown@{unknown}}
\index{unknown@{unknown}!Milter.Base@{Milter.Base}}
\doxysubsubsection{unknown()}
{\footnotesize\ttfamily \label{classMilter_1_1Base_aac5c791a2afd785e890eb8b9b2911527} 
Milter.\+Base.\+unknown (\begin{DoxyParamCaption}\item[{}]{self}{, }\item[{}]{cmd}{}\end{DoxyParamCaption})}



Called when the SMTP client issues an unknown command. 


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


\label{doc-variable-members}
\doxysubsection{Member Data Documentation}
\index{Milter.Base@{Milter.Base}!\_actions@{\_actions}}
\index{\_actions@{\_actions}!Milter.Base@{Milter.Base}}
\doxysubsubsection{\_actions}
{\footnotesize\ttfamily \label{classMilter_1_1Base_ab811ed56bfbedac527f0c7edf59d49b9} 
Milter.\+Base.\+\_\+actions = CURR\+\_\+\+ACTS\hspace{0.3cm}{\ttfamily [protected]}}



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_a982f8004698df8dbba59df470bb485ed}, or by overriding the negotiate callback. The bits include\+: {\ttfamily ADDHDRS,CHGBODY,MODBODY,ADDRCPT,ADDRCPT\+\_\+\+PAR,DELRCPT CHGHDRS,QUARANTINE,CHGFROM,SETSYMLIST}. The {\ttfamily Milter.\+CURR\+\_\+\+ACTS} 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 \textbf{ addheader()}, \textbf{ addrcpt()}, \textbf{ chgfrom()}, \textbf{ chgheader()}, \textbf{ delrcpt()}, \textbf{ negotiate()}, \textbf{ quarantine()}, \textbf{ replacebody()}, \textbf{ Milter.\+test.\+Test\+Base.\+setreply()}, and \textbf{ setsymlist()}.

\index{Milter.Base@{Milter.Base}!\_protocol@{\_protocol}}
\index{\_protocol@{\_protocol}!Milter.Base@{Milter.Base}}
\doxysubsubsection{\_protocol}
{\footnotesize\ttfamily \label{classMilter_1_1Base_a2e02ad6ee4a8f54bcb3cd50785401731} 
int Milter.\+Base.\+\_\+protocol = 0\hspace{0.3cm}{\ttfamily [protected]}}



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 SKIP result code is allowed only if the P\+\_\+\+SKIP bit is set, rejected recipients are passed to the milter application only if the P\+\_\+\+RCPT\+\_\+\+REJ bit is set, and header values are sent and received with leading spaces (in the continuation lines) intact if the P\+\_\+\+HDR\+\_\+\+LEADSPC bit is set (so that the application can customize indenting). ~\newline


The P\+\_\+\+N$\ast$ bits should be negotiated via the @noreply and @nocallback method decorators, and P\+\_\+\+RCPT\+\_\+\+REJ, P\+\_\+\+HDR\+\_\+\+LEADSPC should be enabled using the enable\+\_\+protocols class decorator.

The bits include\+: {\ttfamily  P\+\_\+\+RCPT\+\_\+\+REJ P\+\_\+\+NR\+\_\+\+CONN P\+\_\+\+NR\+\_\+\+HELO P\+\_\+\+NR\+\_\+\+MAIL P\+\_\+\+NR\+\_\+\+RCPT P\+\_\+\+NR\+\_\+\+DATA P\+\_\+\+NR\+\_\+\+UNKN P\+\_\+\+NR\+\_\+\+EOH P\+\_\+\+NR\+\_\+\+BODY P\+\_\+\+NR\+\_\+\+HDR P\+\_\+\+NOCONNECT P\+\_\+\+NOHELO P\+\_\+\+NOMAIL P\+\_\+\+NORCPT P\+\_\+\+NODATA P\+\_\+\+NOUNKNOWN P\+\_\+\+NOEOH P\+\_\+\+NOBODY P\+\_\+\+NOHDRS P\+\_\+\+HDR\+\_\+\+LEADSPC P\+\_\+\+SKIP } (all under the \doxyref{Milter}{p.}{classMilter_1_1Milter} namespace). \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Referenced by \textbf{ negotiate()}, and \textbf{ Milter.\+testctx.\+Test\+Ctx.\+progress()}.



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