Skip Montanaro schreef op 16/07/2018 3:31:
So, problem solved. The example I originally referred to clearly
requires the caller know the encoding of the input file. When you
don't know the encoding, you need bytes. The BytesParser gave me that.
Also, I must admit to having not completely read th
On 2018-07-16, Skip Montanaro wrote:
>> 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 thin
On 16 July 2018 at 02:31, Skip Montanaro wrote:
>> 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 dif
A raw email message should be treated as a ‘bag of bytes’, and in processing
it, the encoding of the various sections determined by headers in the message
(or taking defined defaults if not specified). I suspect that means that you
should read as a binary file. I would hope that the module has t
> 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.
Yes, that's exactly what I'm trying to
On 15Jul2018 23:34, Jon Ribbens wrote:
On 2018-07-15, Skip Montanaro 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 =
On 2018-07-15, Skip Montanaro 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/7948
I have an email message in a file (see attached). According to this page:
https://docs.python.org/3/library/email.examples.html
something like this should construct an email message from the file:
>>> from email.message import EmailMessage
>>> msg = EmailMessage()
>>> fp = open("/home/skip/tmp/7