On May 7, 2014 9:13 AM, "Chris Angelico" <ros...@gmail.com> wrote: > > On Thu, May 8, 2014 at 1:06 AM, Burak Arslan <burak.ars...@arskom.com.tr> wrote: > > Seeing how discussion is still going on about this, I'd like to state > > once more what I said above in other words: You just need to do this: > > > > "Received: blah\r\n" + message.to_string() > > > > or better: > > > > socket.write("Received: blah\r\n") > > socket.write(message.to_string()) > > > > And again, this is not a hack, this is how it's supposed to work. > > Yes, that method does work... if you're taking it in and sending it > right out again. But it means you have to hang onto two pieces of data > - the message and the new Received header - until you write it to a > file/socket.
Alternatively, you could use a BytesIO to prepend the Received header to the raw data *before* you parse it with the email module.
-- https://mail.python.org/mailman/listinfo/python-list