On 8/29/20 3:31 PM, Karsten Hilbert wrote: >> However the problem appears to be that internally in Python 3 mailbox >> class there is an assumption that it's being given 'ascii'. > Do you really _need_ the mailbox class ? From what you've > written so far my understanding was that you receive data > (bytes) and want to append that to a file (which happens > to be an mbox). > > Can't you "just do that" ? > > IOW, read the bytes, open the file, dump the bytes, close the file ? > > Karsten
Just appending a message as a raw file to a mailbox, doesn't properly add it as a new message. You need to add a From: line to the front, and then go through the message and alter any line that begins as "From:" (and possibly any line that begins with something like ">From:" or ">>From:" depending on which mailbox format is being used. There may be a few other small details that needs to happen to. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list