\doxysection{mime Namespace Reference}
\label{namespacemime}\index{mime@{mime}}


This module provides a "{}defang"{} function to replace naughty attachments.  


\doxysubsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \textbf{ Mime\+Generator}
\begin{DoxyCompactList}\small\item\em Fix multipart handling in email.\+Generator. \end{DoxyCompactList}\item 
class \textbf{ Mime\+Message}
\begin{DoxyCompactList}\small\item\em Enhance email.\+message.\+Message. \end{DoxyCompactList}\item 
class \textbf{ \+\_\+defang}
\item 
class \textbf{ SGMLFilter}
\item 
class \textbf{ HTMLScript\+Filter}
\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ zipnames} (txt)
\begin{DoxyCompactList}\small\item\em Return a list of filenames in a zip file. \end{DoxyCompactList}\item 
\textbf{ unquote} (s)
\item 
\label{namespacemime_a29117dcdece271f8fc9b0f09bcfb6268} 
{\bfseries \+\_\+unquotevalue} (value)
\item 
\label{namespacemime_a441963ba22eea1c6a4308f92927fedd2} 
{\bfseries message\+\_\+from\+\_\+file} (fp)
\item 
\label{namespacemime_ae517611afb477486bc72f196f9e9bf5f} 
{\bfseries check\+\_\+ext} (name)
\item 
\label{namespacemime_ad249fd6f5e58cf72ea92e7f8bd8048c3} 
{\bfseries check\+\_\+name} (msg, savname=None, ckname=check\+\_\+ext, scan\+\_\+zip=False)
\item 
\textbf{ check\+\_\+attachments} (msg, check, lev=None)
\item 
\label{namespacemime_a22c9fb90cc0b5c5c6078890d1983c010} 
{\bfseries check\+\_\+html} (msg, savname=None)
\item 
\label{namespacemime_aa9b5059cf38d705a5f6518e88b5b67b9} 
{\bfseries \+\_\+list\+\_\+attach} (msg)
\end{DoxyCompactItemize}
\doxysubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\label{namespacemime_a674f6ca2fa1fdcc6a63f8483bbfa61de} 
{\bfseries Bytes\+IO} = String\+IO
\item 
\label{namespacemime_afcb63630aa0e43569c4061655cea4c2f} 
{\bfseries as\+\_\+bytes}
\item 
\label{namespacemime_a6b6bba9eae84fb8ea1f171749d840a2c} 
str {\bfseries extlist} = \textquotesingle{}\textquotesingle{}.join(.split())
\item 
\label{namespacemime_aaa7a33441aea0a0832b107b22630d6af} 
list {\bfseries bad\+\_\+extensions} = [\textquotesingle{}.\textquotesingle{} + x for x in extlist.\+split(\textquotesingle{},\textquotesingle{})]
\item 
str \textbf{ virus\+\_\+msg}
\item 
\label{namespacemime_a1253e7b5820ae6fab84be938b9c476df} 
{\bfseries defang} = \textbf{ \+\_\+defang}()
\item 
\label{namespacemime_a87593132843e0cb215bb48f4df0debec} 
{\bfseries declname} = re.\+compile(r\textquotesingle{}[a-\/zA-\/Z][-\/\+\_\+.\+a-\/zA-\/Z0-\/9]$\ast$\textbackslash{}s$\ast$\textquotesingle{})
\item 
\label{namespacemime_ad5153f5d01b78b8c88167c35eb569019} 
{\bfseries declstringlit} = re.\+compile(r\textquotesingle{}(\textbackslash{}\textquotesingle{}[$^\wedge$\textbackslash{}\textquotesingle{}]$\ast$\textbackslash{}\textquotesingle{}$\vert$"{}[$^\wedge$"{}]$\ast$"{})\textbackslash{}s$\ast$\textquotesingle{})
\item 
\label{namespacemime_a01f55fc462237ea744a1bbf4d6cd0a98} 
{\bfseries msg} = message\+\_\+from\+\_\+file(fp)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This module provides a "{}defang"{} function to replace naughty attachments. 

We also provide workarounds for bugs in the email module that comes with python. The "{}bugs"{} fixed mostly come up only with malformed messages -\/ but that is what you have when dealing with spam. 

\label{doc-func-members}
\doxysubsection{Function Documentation}
\index{mime@{mime}!check\_attachments@{check\_attachments}}
\index{check\_attachments@{check\_attachments}!mime@{mime}}
\doxysubsubsection{check\_attachments()}
{\footnotesize\ttfamily \label{namespacemime_ac78e550d0f8375f877cf15a16a4f1243} 
mime.\+check\+\_\+attachments (\begin{DoxyParamCaption}\item[{}]{msg}{, }\item[{}]{check}{, }\item[{}]{lev}{ = {\ttfamily None}}\end{DoxyParamCaption})}

\begin{DoxyVerb}Scan attachments.
msg     MimeMessage
check   function(MimeMessage): int
        Return CONTINUE, REJECT, ACCEPT
\end{DoxyVerb}
 

References \textbf{ check\+\_\+attachments()}.



Referenced by \textbf{ mime.\+\_\+defang.\+\_\+\+\_\+call\+\_\+\+\_\+()}, and \textbf{ check\+\_\+attachments()}.

\index{mime@{mime}!unquote@{unquote}}
\index{unquote@{unquote}!mime@{mime}}
\doxysubsubsection{unquote()}
{\footnotesize\ttfamily \label{namespacemime_ab83255c7bb24dd608f5dd6da5ae3ea8e} 
mime.\+unquote (\begin{DoxyParamCaption}\item[{}]{s}{}\end{DoxyParamCaption})}

\begin{DoxyVerb}Remove quotes from a string.\end{DoxyVerb}
 

References \textbf{ unquote()}.



Referenced by \textbf{ unquote()}.

\index{mime@{mime}!zipnames@{zipnames}}
\index{zipnames@{zipnames}!mime@{mime}}
\doxysubsubsection{zipnames()}
{\footnotesize\ttfamily \label{namespacemime_a78139f8fffc5fa2bc838cfb37e82a57d} 
mime.\+zipnames (\begin{DoxyParamCaption}\item[{}]{txt}{}\end{DoxyParamCaption})}



Return a list of filenames in a zip file. 

Embedded zip files are recursively expanded. 

References \textbf{ zipnames()}.



Referenced by \textbf{ mime.\+Mime\+Message.\+getnames()}, and \textbf{ zipnames()}.



\label{doc-var-members}
\doxysubsection{Variable Documentation}
\index{mime@{mime}!virus\_msg@{virus\_msg}}
\index{virus\_msg@{virus\_msg}!mime@{mime}}
\doxysubsubsection{virus\_msg}
{\footnotesize\ttfamily \label{namespacemime_adf5bcce0eec6ac2eab5dccaf31c1c1f3} 
str mime.\+virus\+\_\+msg}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ =\ \ \textcolor{stringliteral}{"{}"{}"{}This\ message\ appeared\ to\ contain\ a\ virus.}}
\DoxyCodeLine{00002\ \textcolor{stringliteral}{It\ was\ originally\ named\ '\%s',\ and\ has\ been\ removed.}}
\DoxyCodeLine{00003\ \textcolor{stringliteral}{A\ copy\ of\ your\ original\ message\ was\ saved\ as\ '\%s:\%s'.}}
\DoxyCodeLine{00004\ \textcolor{stringliteral}{See\ your\ administrator.}}
\DoxyCodeLine{00005\ \textcolor{stringliteral}{"{}"{}"{}}}

\end{DoxyCode}
