This isn't the place to get help on Python coding, but since this is a relatively new API I'll give you a pointer, and then you can tell me where the docs need improvement :)
If you do message_from_string(yourstring, policy=email.policy.default), you should get back an EmailMessage object.
That said, your example does return an EmailMessage for me, if I put a string in place of your self.original_message, which must be something from your program. However, that won't *work* very well, because the policy is set to Compat32, and Compat32 and EmailMessage aren't designed to work together. A lot of things will work fine, but you'll get some weird errors. However, I don't think that that is worth a documentation note, since it is a logical consequence of using _class=EmailMessage without specifying a policy.
|