Skip to content

utf-8 characters prevents dodo form saving to Sent directory #119

Description

@surekur

If an email contains non ascii UTF-8 characters, eml.as_bytes() raises an ASCII encoding error, which prevents the email from being saved to the sent_dir of the mail account and subsequent tasks like reindexing notmutch and tagging the message as replied.

Both replacing as_bytes with as_string() and removing utf8=False (see here) in email Policy solves the problem. Both approaches seem to have the same effect on email encoding (RFC 2045 quoted encoding like =C3=A1 for “á”).

I wonder why utf8=False is explicitly set in the email policy, and also why as_bytes() is used for Maildir manipulation while as_string() is used to pipe the message to the subprocess.

It seems that every component of the modern email stack is perfectly happy with an email encoded using quoted Unicode.

I'm not an emailing expert, and I were suspecting there is a good reason utf-8 is explicitly disabled in mail policy so I extensively tested the saved Sent mail in the imap stack.

I tested it with mbsync <-> Dovecot, and then also fetched it with different user agents like thunderbird, alps and roundcube.
The email were displayed correctly everywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions