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


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


\doxysubsection*{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}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
def \textbf{ zipnames} (txt)
\begin{DoxyCompactList}\small\item\em Return a list of filenames in a zip file. \end{DoxyCompactList}\item 
def \textbf{ unquote} (s)
\item 
\mbox{\label{namespacemime_af7d6dd939cf9d376c5d9e37afbfd82cc}} 
def {\bfseries \+\_\+unquotevalue} (value)
\item 
\mbox{\label{namespacemime_ab726c4958d5fc41917e36cee92a4f4cf}} 
def {\bfseries message\+\_\+from\+\_\+file} (fp)
\item 
\mbox{\label{namespacemime_af6ef47b1de3d284af911d2fc8540cfe1}} 
def {\bfseries check\+\_\+ext} (name)
\item 
\mbox{\label{namespacemime_ab5ca143d708aa173ada0eafa29c9a1a9}} 
def {\bfseries check\+\_\+name} (msg, savname=None, ckname=check\+\_\+ext, scan\+\_\+zip=False)
\item 
def \textbf{ check\+\_\+attachments} (msg, check, lev=None)
\item 
\mbox{\label{namespacemime_adb369301ea2270c35e5e265c10b8ca2a}} 
def {\bfseries check\+\_\+html} (msg, savname=None)
\item 
\mbox{\label{namespacemime_ab7c22774b812dd52bf18f94e24ce5663}} 
def {\bfseries \+\_\+list\+\_\+attach} (msg)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{namespacemime_a674f6ca2fa1fdcc6a63f8483bbfa61de}} 
{\bfseries Bytes\+IO} = String\+IO
\item 
\mbox{\label{namespacemime_afcb63630aa0e43569c4061655cea4c2f}} 
{\bfseries as\+\_\+bytes}
\item 
\mbox{\label{namespacemime_a28ea916ef2128b3ff9308cef86a3f120}} 
string {\bfseries extlist} = \textquotesingle{}\textquotesingle{}.join(.split())
\item 
\mbox{\label{namespacemime_aaa7a33441aea0a0832b107b22630d6af}} 
list {\bfseries bad\+\_\+extensions} = [\textquotesingle{}.\textquotesingle{} + x for x in extlist.\+split(\textquotesingle{},\textquotesingle{})]
\item 
string {\bfseries virus\+\_\+msg}
\item 
\mbox{\label{namespacemime_a1253e7b5820ae6fab84be938b9c476df}} 
{\bfseries defang} = \textbf{ \+\_\+defang}()
\item 
\mbox{\label{namespacemime_a87593132843e0cb215bb48f4df0debec}} 
{\bfseries declname} = re.\+compile(r\textquotesingle{}[a-\/zA-\/Z][-\/\+\_\+.\+a-\/zA-\/Z0-\/9]$\ast$\textbackslash{}s$\ast$\textquotesingle{})
\item 
\mbox{\label{namespacemime_ad5153f5d01b78b8c88167c35eb569019}} 
{\bfseries declstringlit} = re.\+compile(r\textquotesingle{}(\textbackslash{}\textquotesingle{}[$^\wedge$\textbackslash{}\textquotesingle{}]$\ast$\textbackslash{}\textquotesingle{}$\vert$\char`\"{}[$^\wedge$\char`\"{}]$\ast$\char`\"{})\textbackslash{}s$\ast$\textquotesingle{})
\item 
\mbox{\label{namespacemime_a359b76bbfed80f1a4cdc3ffd238931d8}} 
def {\bfseries msg} = message\+\_\+from\+\_\+file(fp)
\end{DoxyCompactItemize}


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

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

\doxysubsection{Function Documentation}
\mbox{\label{namespacemime_abc439085c11c0dc341b9e08af224eccf}} 
\index{mime@{mime}!check\_attachments@{check\_attachments}}
\index{check\_attachments@{check\_attachments}!mime@{mime}}
\doxysubsubsection{check\_attachments()}
{\footnotesize\ttfamily def 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}
 

Referenced by mime.\+\_\+defang.\+\_\+\+\_\+call\+\_\+\+\_\+().

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

\begin{DoxyVerb}Remove quotes from a string.\end{DoxyVerb}
 \mbox{\label{namespacemime_ac987c500e1755eaf5904708a4d6b57b3}} 
\index{mime@{mime}!zipnames@{zipnames}}
\index{zipnames@{zipnames}!mime@{mime}}
\doxysubsubsection{zipnames()}
{\footnotesize\ttfamily def mime.\+zipnames (\begin{DoxyParamCaption}\item[{}]{txt }\end{DoxyParamCaption})}



Return a list of filenames in a zip file. 

Embedded zip files are recursively expanded. 

Referenced by mime.\+Mime\+Message.\+getnames().



\doxysubsection{Variable Documentation}
\mbox{\label{namespacemime_af6b651706008a7a179b1489ea302b736}} 
\index{mime@{mime}!virus\_msg@{virus\_msg}}
\index{virus\_msg@{virus\_msg}!mime@{mime}}
\doxysubsubsection{virus\_msg}
{\footnotesize\ttfamily string mime.\+virus\+\_\+msg}

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

\end{DoxyCode}
