Skip to content
Snippets Groups Projects
Commit 1b057dd7 authored by Julien Castiaux's avatar Julien Castiaux
Browse files

[REF] mail,test_mail: prefer EmailMessage over deprecated Message

[PEP 594][1] is going to depreciate legacy `email.message.Message` API in
PY3.8 in favor `email.message.EmailMessage`.

All `email.message_from_x` constructor functions take an optional
`policy` argument. The policy can either be `policy.compat32` to
generate an `email.message.Message` instance, either be `policy.SMTP`
to generate an `email.message.EmailMessage` instance.

The [current][2] default policy is `policy.compat32` but will change in
a future version of python. It is recommended to always specify the
policy.

[1]: https://www.python.org/dev/peps/pep-0594/#email-legacy-api
[2] https://docs.python.org/3.7/library/email.parser.html#email.parser.BytesParser
parent a7a63bdb
Branches
Tags
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment