\doxysection{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 SMTP connection.  


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


\doxysubsection{Detailed Description}
A do \char`\"{}nothing\char`\"{} \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 \char`\"{}actions\char`\"{} or \char`\"{}callbacks\char`\"{}. 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. ~\newline
 

\doxysubsection{Member Function Documentation}
\mbox{\label{classMilter_1_1Base_aef01a2465e563ad1435030cfc9b30939}} 
\index{Milter.Base@{Milter.Base}!abort@{abort}}
\index{abort@{abort}!Milter.Base@{Milter.Base}}
\doxysubsubsection{abort()}
{\footnotesize\ttfamily def 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_a34f37d5fbc5d9408b6d5bed9d1c75997}.

\mbox{\label{classMilter_1_1Base_a23df18e239f441049e17d4e87b61be1c}} 
\index{Milter.Base@{Milter.Base}!addheader@{addheader}}
\index{addheader@{addheader}!Milter.Base@{Milter.Base}}
\doxysubsubsection{addheader()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_ab84d4d9d9d0e4e945b24661a2dac36b1}} 
\index{Milter.Base@{Milter.Base}!addrcpt@{addrcpt}}
\index{addrcpt@{addrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{addrcpt()}
{\footnotesize\ttfamily def 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 \char`\"{}self.\+addrcpt(\textquotesingle{}$<$foo@example.\+com$>$\textquotesingle{})\char`\"{}. ~\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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a963e42c7fcf7bb1a967af48c878b00c7}} 
\index{Milter.Base@{Milter.Base}!body@{body}}
\index{body@{body}!Milter.Base@{Milter.Base}}
\doxysubsubsection{body()}
{\footnotesize\ttfamily def 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 Milter.\+test.\+Test\+Base.\+feed\+File().

\mbox{\label{classMilter_1_1Base_a47ab1a93726b64475a844563852e5b9a}} 
\index{Milter.Base@{Milter.Base}!chgfrom@{chgfrom}}
\index{chgfrom@{chgfrom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{chgfrom()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a1a347409d4a5df7a885034d4cae04b56}} 
\index{Milter.Base@{Milter.Base}!chgheader@{chgheader}}
\index{chgheader@{chgheader}!Milter.Base@{Milter.Base}}
\doxysubsubsection{chgheader()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a6f851a653da04dde2a2f3bf115b8e279}} 
\index{Milter.Base@{Milter.Base}!connect@{connect}}
\index{connect@{connect}!Milter.Base@{Milter.Base}}
\doxysubsubsection{connect()}
{\footnotesize\ttfamily def 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 \char`\"{}[1.\+2.\+3.\+4]\char`\"{} if no PTR is available. The format of hostaddr depends on the socket family\+: 
\begin{DoxyDescription}
\item[{\ttfamily socket.\+AF\+\_\+\+INET} ]A tuple of (IP as string in dotted quad form, integer port) 
\item[{\ttfamily socket.\+AF\+\_\+\+INET6} ]A tuple of (IP as a string in standard representation, integer port, integer flow info, integer scope id) 
\item[{\ttfamily socket.\+AF\+\_\+\+UNIX} ]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 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_a4de2609d8b878444747f61fe37e0ffd5}.

\mbox{\label{classMilter_1_1Base_abf00ce24c390ab0a4a05d636fa998e44}} 
\index{Milter.Base@{Milter.Base}!data@{data}}
\index{data@{data}!Milter.Base@{Milter.Base}}
\doxysubsubsection{data()}
{\footnotesize\ttfamily def 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 Milter.\+test.\+Test\+Base.\+feed\+File().

\mbox{\label{classMilter_1_1Base_a74c8c1dc261266865905f228370cf835}} 
\index{Milter.Base@{Milter.Base}!delrcpt@{delrcpt}}
\index{delrcpt@{delrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{delrcpt()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a3d6e5676f4bc54069c996f404d474f41}} 
\index{Milter.Base@{Milter.Base}!envfrom@{envfrom}}
\index{envfrom@{envfrom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envfrom()}
{\footnotesize\ttfamily def 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 \char`\"{}envelope\char`\"{} 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_a22df44f0417b6a538c80e709b5dbd9bb}. 

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



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

\mbox{\label{classMilter_1_1Base_ada55b78d0ca17b3d94f95c0d29a1b384}} 
\index{Milter.Base@{Milter.Base}!envfrom\_bytes@{envfrom\_bytes}}
\index{envfrom\_bytes@{envfrom\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envfrom\_bytes()}
{\footnotesize\ttfamily def 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_a22df44f0417b6a538c80e709b5dbd9bb} instead, or trap utf-\/8 conversion exception, etc. 
\end{DoxySince}


References Milter.\+Base.\+envfrom(), and Milter.\+Milter.\+envfrom().

\mbox{\label{classMilter_1_1Base_a16118f646296c8b2685077a18bdf4b3b}} 
\index{Milter.Base@{Milter.Base}!envrcpt@{envrcpt}}
\index{envrcpt@{envrcpt}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envrcpt()}
{\footnotesize\ttfamily def 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 \char`\"{}envelope\char`\"{} 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_a22df44f0417b6a538c80e709b5dbd9bb}. 

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



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

\mbox{\label{classMilter_1_1Base_aab7082bbe45c51d8fd0944a1d10aa5fd}} 
\index{Milter.Base@{Milter.Base}!envrcpt\_bytes@{envrcpt\_bytes}}
\index{envrcpt\_bytes@{envrcpt\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{envrcpt\_bytes()}
{\footnotesize\ttfamily def 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_a22df44f0417b6a538c80e709b5dbd9bb} instead, or trap utf-\/8 conversion exception, etc. 
\end{DoxySince}


References Milter.\+Base.\+envrcpt(), and Milter.\+Milter.\+envrcpt().

\mbox{\label{classMilter_1_1Base_a725f845830639b76f479dc6c0f7f8c00}} 
\index{Milter.Base@{Milter.Base}!eom@{eom}}
\index{eom@{eom}!Milter.Base@{Milter.Base}}
\doxysubsubsection{eom()}
{\footnotesize\ttfamily def 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_aa4d8694a29ce27828fa10f3633911099}.



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

\mbox{\label{classMilter_1_1Base_ac5b454b632d5fe6a5f1157e44ec70920}} 
\index{Milter.Base@{Milter.Base}!getsymval@{getsymval}}
\index{getsymval@{getsymval}!Milter.Base@{Milter.Base}}
\doxysubsubsection{getsymval()}
{\footnotesize\ttfamily def 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. \char`\"{}j\char`\"{}) or multiple chars enclosed in braces (e.\+g. \char`\"{}\{auth\+\_\+type\}\char`\"{}). 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 Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a22df44f0417b6a538c80e709b5dbd9bb}} 
\index{Milter.Base@{Milter.Base}!header@{header}}
\index{header@{header}!Milter.Base@{Milter.Base}}
\doxysubsubsection{header()}
{\footnotesize\ttfamily def 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_a3ef4af127a63a443f5d7397983bb2055}.



Referenced by Milter.\+Base.\+header\+\_\+bytes().

\mbox{\label{classMilter_1_1Base_a7e1d6225b84556ba638217539382455a}} 
\index{Milter.Base@{Milter.Base}!header\_bytes@{header\_bytes}}
\index{header\_bytes@{header\_bytes}!Milter.Base@{Milter.Base}}
\doxysubsubsection{header\_bytes()}
{\footnotesize\ttfamily def 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_a22df44f0417b6a538c80e709b5dbd9bb} 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 Milter.\+Base.\+header(), Milter.\+Milter.\+header(), and Milter.\+Base.\+header\+\_\+bytes.



Referenced by Milter.\+test.\+Test\+Base.\+feed\+File(), and Milter.\+Base.\+header\+\_\+bytes().

\mbox{\label{classMilter_1_1Base_a5aa99b34a5b4a9cd220fd4d936bfb43b}} 
\index{Milter.Base@{Milter.Base}!hello@{hello}}
\index{hello@{hello}!Milter.Base@{Milter.Base}}
\doxysubsubsection{hello()}
{\footnotesize\ttfamily def 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_a9df63efd8b44bd18246e337f693366a3}.



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

\mbox{\label{classMilter_1_1Base_aeadc158feb217d3667266fb1ccf17398}} 
\index{Milter.Base@{Milter.Base}!negotiate@{negotiate}}
\index{negotiate@{negotiate}!Milter.Base@{Milter.Base}}
\doxysubsubsection{negotiate()}
{\footnotesize\ttfamily def 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 Milter.\+SKIP. 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, Milter.\+test.\+Test\+Base.\+\_\+protocol, Milter.\+testctx.\+Test\+Ctx.\+\_\+protocol, Milter.\+Base.\+protocol\+\_\+mask(), Milter.\+Base.\+setsymlist(), milter.\+milter\+Context.\+setsymlist(), Milter.\+test.\+Test\+Base.\+setsymlist(), and Milter.\+testctx.\+Test\+Ctx.\+setsymlist().



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

\mbox{\label{classMilter_1_1Base_a205b0299e1522dc90b8f966ca45605b9}} 
\index{Milter.Base@{Milter.Base}!progress@{progress}}
\index{progress@{progress}!Milter.Base@{Milter.Base}}
\doxysubsubsection{progress()}
{\footnotesize\ttfamily def 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 \char`\"{}hung\char`\"{} milter. 

References Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_aac1122e063303641aa7fae68e4e85fce}} 
\index{Milter.Base@{Milter.Base}!protocol\_mask@{protocol\_mask}}
\index{protocol\_mask@{protocol\_mask}!Milter.Base@{Milter.Base}}
\doxysubsubsection{protocol\_mask()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+negotiate().

\mbox{\label{classMilter_1_1Base_ad13ec12846ef63c8d7f068a9734a3402}} 
\index{Milter.Base@{Milter.Base}!quarantine@{quarantine}}
\index{quarantine@{quarantine}!Milter.Base@{Milter.Base}}
\doxysubsubsection{quarantine()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a568fdb57a923406da9d1b6d314fbaf99}} 
\index{Milter.Base@{Milter.Base}!replacebody@{replacebody}}
\index{replacebody@{replacebody}!Milter.Base@{Milter.Base}}
\doxysubsubsection{replacebody()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a7dcd1cd29362ecb581faeeda0cfce823}} 
\index{Milter.Base@{Milter.Base}!setreply@{setreply}}
\index{setreply@{setreply}!Milter.Base@{Milter.Base}}
\doxysubsubsection{setreply()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+ctx.

\mbox{\label{classMilter_1_1Base_a2d2ae5bd7f4f10f39103ab36ac6b3b79}} 
\index{Milter.Base@{Milter.Base}!setsymlist@{setsymlist}}
\index{setsymlist@{setsymlist}!Milter.Base@{Milter.Base}}
\doxysubsubsection{setsymlist()}
{\footnotesize\ttfamily def 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 Milter.\+Base.\+\_\+actions, and Milter.\+Base.\+\_\+ctx.



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

\mbox{\label{classMilter_1_1Base_ac5f378191774345521af24d1ca38292e}} 
\index{Milter.Base@{Milter.Base}!unknown@{unknown}}
\index{unknown@{unknown}!Milter.Base@{Milter.Base}}
\doxysubsubsection{unknown()}
{\footnotesize\ttfamily def 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}


\doxysubsection{Member Data Documentation}
\mbox{\label{classMilter_1_1Base_ab811ed56bfbedac527f0c7edf59d49b9}} 
\index{Milter.Base@{Milter.Base}!\_actions@{\_actions}}
\index{\_actions@{\_actions}!Milter.Base@{Milter.Base}}
\doxysubsubsection{\_actions}
{\footnotesize\ttfamily Milter.\+Base.\+\_\+actions\hspace{0.3cm}{\ttfamily [private]}}



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 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 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().

\mbox{\label{classMilter_1_1Base_a2b029cd0e1e8a56340a09cb64425f024}} 
\index{Milter.Base@{Milter.Base}!\_protocol@{\_protocol}}
\index{\_protocol@{\_protocol}!Milter.Base@{Milter.Base}}
\doxysubsubsection{\_protocol}
{\footnotesize\ttfamily Milter.\+Base.\+\_\+protocol\hspace{0.3cm}{\ttfamily [private]}}



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 Milter.\+Base.\+negotiate(), and Milter.\+testctx.\+Test\+Ctx.\+progress().



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