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


Groups > comp.lang.python > #70954

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'receives': 0.04; 'method,': 0.09; 'rfc': 0.09; 'subject:position': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'fixing.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'smtp,': 0.16; 'subject:Add': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'app': 0.19; 'module': 0.19; 'trying': 0.19; "python's": 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'headers': 0.24; 'mon,': 0.24; 'server.': 0.24; 'cc:2**0': 0.24; 'required.': 0.27; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'specifically': 0.29; 'correct': 0.29; 'chris': 0.29; '[1]': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '>>>>': 0.31; 'header,': 0.31; 'trivial': 0.31; 'probably': 0.32; 'figure': 0.32; 'supposed': 0.32; 'another': 0.32; 'says': 0.33; "i'd": 0.34; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'smtp': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'being': 0.38; 'ends': 0.38; 'issue': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'how': 0.40; 'even': 0.60; 'easy': 0.60; 'received:': 0.65; 'route': 0.84; 'edwards': 0.91; 'to:none': 0.92; 'anywhere,': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=8Q31Iz0Dc0PkCsPPAYCBH8KbNaYUabLYIaSwwZVcvmg=; b=Ir7mTNuflqaJrfxMUEKrfcNFK7uZq6tqdz5CLucK+H7svdAda8/3OfjmZOoezzHB7W k1Us6ssgsXLj4agNrz+Kxkis16+lEmk24gFqzU++7yG9dXIfQN8xvaCNk/rJdKy1y/Hs sdaMWEX7+V3HFSRnGA8rhR12WfoVu2vjNfOYFZabHhEvPpF1ZfpDoGKEAh1Q4Mz06t5w vtIa7a4W1lXz7G4BQyDh2f2DNzXvQcFKti9snzw5SxRgqBBinP80f/oZeUinoGmsw6G3 92gR3Rjuh2pWCNIbzXcIvxDvf5whFkI8x+I77DI4uq+TSK3YTMSraFbWZd8TWrpUbf03 itkQ==
MIME-Version 1.0
X-Received by 10.52.164.175 with SMTP id yr15mr286814vdb.59.1399372900185; Tue, 06 May 2014 03:41:40 -0700 (PDT)
In-Reply-To <5N2av.257203$q95.207421@fx22.am4>
References <lk8q3j$3mg$2@reader1.panix.com> <tK1av.250678$q95.71799@fx22.am4> <mailman.9693.1399369682.18130.python-list@python.org> <5N2av.257203$q95.207421@fx22.am4>
Date Tue, 6 May 2014 20:41:40 +1000
Subject Re: Add "Received:" header to email msg in correct position?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9695.1399372909.18130.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1399372909 news.xs4all.nl 2934 [2001:888:2000:d::a6]:57153
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70954

Show key headers only | View raw


On Tue, May 6, 2014 at 8:26 PM, alister
<alister.nospam.ware@ntlworld.com> wrote:
> On Tue, 06 May 2014 19:47:54 +1000, Chris Angelico wrote:
>
>> On Tue, May 6, 2014 at 7:15 PM, alister
>> <alister.nospam.ware@ntlworld.com> wrote:
>>> On Mon, 05 May 2014 19:51:15 +0000, Grant Edwards wrote:
>>>
>>>> I'm working on a Python app that receives an e-mail message via SMTP,
>>>> does some trivial processing on it, and forwards it to another SMTP
>>>> server.
>>>>
>>>> I'd like to do the polite thing and add a "Received:" header, but I
>>>> can't figure out how to get Python's email module to add it in the
>>>> correct place.  It always ends up at the "bottom" of the headers below
>>>> From: To: etc.  It's supposed to go at the above all the Received:
>>>> headers that where there when I received it.
>>>
>>> Is this required or just being polite?
>>> what I mean is does the standard state the headers must be in a
>>> particular order or can they appear anywhere, you may be spending time
>>> trying to resolve an issue that does not need fixing.
>>
>> Yes, it's required. RFC 2821 [1] section 3.8.2 says "prepend".
>>
>> ChrisA
>>
>> [1] http://www.ietf.org/rfc/rfc2821.txt
>
> oh well, so much for the easy route :-)
> This suggests the email module could do with amending so that headers can
> be pretended as appended.

Even if it's special-cased as a dedicated "prepend received header"
method, that would probably do. I can't think of any other headers
where you need to specifically order them rather than appending.

ChrisA

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