Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71059

Re: Add "Received:" header to email msg in correct position?

References (2 earlier) <CAPTjJmpxKSMnY=bnDfxtzJM_F1u2x8LrVHhk2+MzwO1GfjDZyA@mail.gmail.com> <mailman.9701.1399389121.18130.python-list@python.org> <lkauuj$lpl$1@reader1.panix.com> <536A4BF7.6040000@arskom.com.tr> <CAPTjJmoyP+dqPG0Wb8p-DzMyS_QzBLx4839uapR8tatMPjRivw@mail.gmail.com>
Date 2014-05-07 16:29 -0600
Subject Re: Add "Received:" header to email msg in correct position?
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9751.1399502104.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On May 7, 2014 9:13 AM, "Chris Angelico" <rosuav@gmail.com> wrote:
>
> On Thu, May 8, 2014 at 1:06 AM, Burak Arslan <burak.arslan@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-05 19:51 +0000
  Re: Add "Received:" header to email msg in correct position? Ethan Furman <ethan@stoneleaf.us> - 2014-05-05 13:01 -0700
    Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-05 20:58 +0000
      Re: Add "Received:" header to email msg in correct position? Tim Chase <python.list@tim.thechases.com> - 2014-05-05 16:09 -0500
        Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-06 02:13 +0000
          Re: Add "Received:" header to email msg in correct position? Steven D'Aprano <steve@pearwood.info> - 2014-05-06 08:22 +0000
            Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-06 14:12 +0000
      Re: Add "Received:" header to email msg in correct position? Terry Reedy <tjreedy@udel.edu> - 2014-05-06 14:16 -0400
      Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-07 10:13 +1000
  Re: Add "Received:" header to email msg in correct position? alister <alister.nospam.ware@ntlworld.com> - 2014-05-06 09:15 +0000
    Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-06 19:47 +1000
      Re: Add "Received:" header to email msg in correct position? alister <alister.nospam.ware@ntlworld.com> - 2014-05-06 10:26 +0000
        Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-06 20:41 +1000
    Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-06 14:15 +0000
      Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-06 14:19 +0000
      Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-07 00:26 +1000
      Re: Add "Received:" header to email msg in correct position? alister <alister.nospam.ware@ntlworld.com> - 2014-05-06 15:16 +0000
    Re: Add "Received:" header to email msg in correct position? Burak Arslan <burak.arslan@arskom.com.tr> - 2014-05-06 18:11 +0300
      Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-06 15:26 +0000
        Re: Add "Received:" header to email msg in correct position? Burak Arslan <burak.arslan@arskom.com.tr> - 2014-05-07 18:06 +0300
        Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-08 01:11 +1000
        Re: Add "Received:" header to email msg in correct position? Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-07 16:29 -0600
          Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-08 13:28 +0000
            Re: Add "Received:" header to email msg in correct position? Chris Angelico <rosuav@gmail.com> - 2014-05-08 23:47 +1000
            Re: Add "Received:" header to email msg in correct position? Ethan Furman <ethan@stoneleaf.us> - 2014-05-08 06:46 -0700
            Re: Add "Received:" header to email msg in correct position? Skip Montanaro <skip@pobox.com> - 2014-05-08 09:50 -0500
              Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-08 18:39 +0000
                Re: Add "Received:" header to email msg in correct position? Tim Chase <python.list@tim.thechases.com> - 2014-05-08 13:48 -0500
                Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-09 14:28 +0000
                Re: Add "Received:" header to email msg in correct position? Ethan Furman <ethan@stoneleaf.us> - 2014-05-08 17:00 -0700
  Re: Add "Received:" header to email msg in correct position? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-07 08:58 +0200
    Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-07 14:32 +0000
      Re: Add "Received:" header to email msg in correct position? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-08 09:44 +0200
  Re: Add "Received:" header to email msg in correct position? Emre Hasegeli <emre@hasegeli.com> - 2014-05-07 11:11 +0300
  Re: Add "Received:" header to email msg in correct position? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-07 10:57 +0200
    Re: Add "Received:" header to email msg in correct position? Grant Edwards <invalid@invalid.invalid> - 2014-05-07 14:33 +0000

csiph-web