Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id F227F4196F0 for ; Thu, 8 Apr 2010 08:07:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Level: X-Spam-Status: No, score=-2.301 tagged_above=-999 required=5 tests=[BAYES_20=-0.001, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4FsacYNCgFjA for ; Thu, 8 Apr 2010 08:07:50 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by olra.theworths.org (Postfix) with ESMTP id 0B7C8431FC1 for ; Thu, 8 Apr 2010 08:07:50 -0700 (PDT) Received: from localhost ([::1] helo=localhost.localdomain) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NztKf-0000Ft-3h; Thu, 08 Apr 2010 15:07:49 +0000 Received: by localhost.localdomain (Postfix, from userid 500) id B15F0C00E4; Thu, 8 Apr 2010 08:07:48 -0700 (PDT) From: Dirk Hohndel To: Sebastian Spaeth , notmuch@notmuchmail.org Subject: Re: [PATCH] Fix code extracting the MTA from Received: headers In-Reply-To: <877hoil6i5.fsf@SSpaeth.de> References: <877hoil6i5.fsf@SSpaeth.de> Date: Thu, 08 Apr 2010 08:07:48 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2010 15:07:51 -0000 On Thu, 08 Apr 2010 09:59:14 +0200, "Sebastian Spaeth" wrote: > On 2010-04-07, Dirk Hohndel wrote: > > > > The previous code made too many assumptions about the (sadly not > > standardized) format of the Received headers. This version should > > be more robust to deal with different variations. > > This code might be useful for some, but I know it is not being useful > for me. I use e.g. dreamhost.com as my mail provider and I never have my > email domain name show up after the Received: by ..... > See my Received headers for your message below. That's the funny thing about heuristics - they are always based on the cases the author has access to. I run my own mail servers and they put in useful Received lines. Dreamhost doesn't appear to do that - I'm sure there are many other scenarios that I don't handle, yet. Please keep them coming. > On the other hand, it contains "for " stating the > intended email address explicitely. IMHO, we should use this before we > start some hand-wavy guessing. > > Also, I have the "X-Original-To: sebastian@sspaeth.de" header. Is that > something that we could make use of before starting to guess? It's complicated. Some MTAs put in bogux "for " or "for UID 1000" into Received headers. I haven't seen any incorrect "X-Original-To" headers, but wouldn't be surprised to see those be faked or wrong, either. Right now my plan is to do something like this: 1) look for my email address in To/Cc 2) look for my email in "for " in Received headers 3) look for my email in X-Original-To 4) look for the domain of my email in Received headers (not just 1st) 5) punt and use default email address Does that sound sane? (and thanks for sending the headers - this really helps... can others for whom the current code or the logic mentioned above wouldn't work send their headers, too, please?) /D -- Dirk Hohndel Intel Open Source Technology Center