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


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


\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class {\bf \+\_\+defang}
\item 
class {\bf Mime\+Generator}
\begin{DoxyCompactList}\small\item\em Fix multipart handling in email.\+Generator. \end{DoxyCompactList}\item 
class {\bf Mime\+Message}
\begin{DoxyCompactList}\small\item\em Enhance email.\+Message. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
def {\bf zipnames} (txt)
\begin{DoxyCompactList}\small\item\em Return a list of filenames in a zip file. \end{DoxyCompactList}\item 
def {\bf unquote} (s)
\item 
def {\bfseries \+\_\+unquotevalue} (value)\label{namespacemime_af7d6dd939cf9d376c5d9e37afbfd82cc}

\item 
def {\bfseries message\+\_\+from\+\_\+file} (fp)\label{namespacemime_ab726c4958d5fc41917e36cee92a4f4cf}

\item 
def {\bfseries check\+\_\+ext} (name)\label{namespacemime_af6ef47b1de3d284af911d2fc8540cfe1}

\item 
def {\bfseries check\+\_\+name}\label{namespacemime_aa08e1169a860d8cc414f1735894462f7}

\item 
def {\bf check\+\_\+attachments} (msg, check)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
string {\bfseries extlist} = \textquotesingle{}\textquotesingle{}\label{namespacemime_a28ea916ef2128b3ff9308cef86a3f120}

\item 
tuple {\bfseries bad\+\_\+extensions} = map(lambda x\+:\textquotesingle{}.\textquotesingle{} + x,extlist.\+split(\textquotesingle{},\textquotesingle{}))\label{namespacemime_af98930bdd55ca491d8757acdac5773b5}

\item 
string {\bfseries virus\+\_\+msg}
\item 
tuple {\bfseries defang} = {\bf \+\_\+defang}()\label{namespacemime_ac0cd1d63f2f4c8e9f01bfa9131074857}

\item 
tuple {\bfseries declname} = re.\+compile(r\textquotesingle{}[a-\/z\+A-\/Z][-\/\+\_\+.\+a-\/z\+A-\/Z0-\/9]$\ast$\textbackslash{}s$\ast$\textquotesingle{})\label{namespacemime_a162776fd11c977293fed79e7b4f7dd5c}

\end{DoxyCompactItemize}


\subsection{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. 

\subsection{Function Documentation}
\index{mime@{mime}!check\+\_\+attachments@{check\+\_\+attachments}}
\index{check\+\_\+attachments@{check\+\_\+attachments}!mime@{mime}}
\subsubsection[{check\+\_\+attachments}]{\setlength{\rightskip}{0pt plus 5cm}def mime.\+check\+\_\+attachments (
\begin{DoxyParamCaption}
\item[{}]{msg, }
\item[{}]{check}
\end{DoxyParamCaption}
)}\label{namespacemime_a8dd1f5a3b3264cf9386a3652dc277ee6}
\begin{DoxyVerb}Scan attachments.
msg     MimeMessage
check   function(MimeMessage): int
      Return CONTINUE, REJECT, ACCEPT
\end{DoxyVerb}
 

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

\index{mime@{mime}!unquote@{unquote}}
\index{unquote@{unquote}!mime@{mime}}
\subsubsection[{unquote}]{\setlength{\rightskip}{0pt plus 5cm}def mime.\+unquote (
\begin{DoxyParamCaption}
\item[{}]{s}
\end{DoxyParamCaption}
)}\label{namespacemime_a22995b40d0b428aed22743e7f7228d22}
\begin{DoxyVerb}Remove quotes from a string.\end{DoxyVerb}
 \index{mime@{mime}!zipnames@{zipnames}}
\index{zipnames@{zipnames}!mime@{mime}}
\subsubsection[{zipnames}]{\setlength{\rightskip}{0pt plus 5cm}def mime.\+zipnames (
\begin{DoxyParamCaption}
\item[{}]{txt}
\end{DoxyParamCaption}
)}\label{namespacemime_ac987c500e1755eaf5904708a4d6b57b3}


Return a list of filenames in a zip file. 

Embedded zip files are recursively expanded. 

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



\subsection{Variable Documentation}
\index{mime@{mime}!virus\+\_\+msg@{virus\+\_\+msg}}
\index{virus\+\_\+msg@{virus\+\_\+msg}!mime@{mime}}
\subsubsection[{virus\+\_\+msg}]{\setlength{\rightskip}{0pt plus 5cm}string mime.\+virus\+\_\+msg}\label{namespacemime_af6b651706008a7a179b1489ea302b736}
{\bfseries Initial value\+:}
\begin{DoxyCode}
1 = \textcolor{stringliteral}{"""This message appeared to contain a virus.}
2 \textcolor{stringliteral}{It was originally named '%s', and has been removed.}
3 \textcolor{stringliteral}{A copy of your original message was saved as '%s:%s'.}
4 \textcolor{stringliteral}{See your administrator.}
5 \textcolor{stringliteral}{"""}
\end{DoxyCode}
