Reading EmailMessage from file

Jon Ribbens jon+usenet at
Sun Jul 15 19:34:12 EDT 2018

On 2018-07-15, Skip Montanaro <skip.montanaro at> wrote:
> I have an email message in a file (see attached).

Attachments don't work here.

> something like this should construct an email message from the file:
>>>> from email.message import EmailMessage
>>>> msg = EmailMessage()
>>>> fp = open("/home/skip/tmp/79487694")
>>>> msg.set_content(

What are you actually trying to do? You're talking like you're trying
to read an existing RFC822 email-with-headers from a file, but you're
showing code that creates a new email with body content set from
a file, which is a completely different thing.

More information about the Python-list mailing list