This module provides a "defang" function to replace naughty attachments. More...
Classes | |
class | MimeGenerator |
Fix multipart handling in email.Generator. More... | |
class | MimeMessage |
Enhance email.Message. More... | |
class | _defang |
Functions | |
def | zipnames |
Return a list of filenames in a zip file. | |
def | unquote |
def | _unquotevalue |
def | message_from_file |
def | check_ext |
def | check_name |
def | check_attachments |
Variables | |
string | extlist = '' |
tuple | bad_extensions = map(lambda x:'.' + x,extlist.split(',')) |
string | virus_msg |
tuple | defang = _defang() |
tuple | declname = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*') |
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.
def mime.check_attachments | ( | msg, | ||
check | ||||
) |
Scan attachments. msg MimeMessage check function(MimeMessage): int Return CONTINUE, REJECT, ACCEPT
def mime.unquote | ( | s | ) |
Remove quotes from a string.
def mime.zipnames | ( | txt | ) |
Return a list of filenames in a zip file.
Embedded zip files are recursively expanded.
string mime.virus_msg |
"""This message appeared to contain a virus. It was originally named '%s', and has been removed. A copy of your original message was saved as '%s:%s'. See your administrator. """