diff options
Diffstat (limited to 'script/extract.py')
-rwxr-xr-x | script/extract.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/script/extract.py b/script/extract.py index a54f992..3a3a17c 100755 --- a/script/extract.py +++ b/script/extract.py @@ -30,6 +30,7 @@ import re from argparse import ArgumentParser from base64 import b64encode from datetime import datetime +from email.message import EmailMessage from itertools import islice from mailbox import Maildir, MaildirMessage from os import environ, getpid, path, setuid @@ -395,9 +396,10 @@ def raw_mail(f, req): if hasattr(b, "__next__"): raise QMAuthError("can not stop at multipart section", path=pth) - - if isinstance(b, str): + elif isinstance(b, str): b = b.encode() + elif isinstance(b, EmailMessage): + b = b.as_bytes() return jwebmail.RawResp(header=h, body=b).SerializeToString() |