Example #1
0
def demux_email(filename, options):
    retlist = []
    try:
        with open(filename, "rb") as openfile:
            buf = openfile.read()
            atts = find_attachments_in_email(buf, True)
            if atts and len(atts):
                for att in atts:
                    retlist.append(att[0])
    except:
        pass

    return retlist
Example #2
0
def demux_email(filename, options):
    retlist = []
    try:
        with open(filename, "rb") as openfile:
            buf = openfile.read()
            atts = find_attachments_in_email(buf, True)
            if atts and len(atts):
                for att in atts:
                    retlist.append(att[0])
    except:
        pass

    return retlist
 def test_find_attachments_expand(self):
     atts = find_attachments_in_email(SAMPLE_EMAIL, True)
     assert_equal(len(atts), 3)
     assert_true(any(t[1] == u'\u60e1\u610f\u8edf\u9ad4.doc' for t in atts))
 def test_find_attachments(self):
     atts = find_attachments_in_email(SAMPLE_EMAIL, False)
     assert_equal(len(atts), 1)
     assert_false(any(t[1] == u'\u60e1\u610f\u8edf\u9ad4.doc' for t in atts))
     assert_true(any(t[1] == u'<unknown>.doc' for t in atts))