--- /dev/null
+Return-Path: <jan.n.klug@rub.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9F33B431FBD\r
+ for <notmuch@notmuchmail.org>; Mon, 26 Jan 2015 03:04:56 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.138\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.138 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_MED=-2.3]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id XP2464hS8gsN for <notmuch@notmuchmail.org>;\r
+ Mon, 26 Jan 2015 03:04:53 -0800 (PST)\r
+Received: from mx4.rz.ruhr-uni-bochum.de (mi.ruhr-uni-bochum.de\r
+ [134.147.64.53])\r
+ by olra.theworths.org (Postfix) with SMTP id 19514431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 26 Jan 2015 03:04:52 -0800 (PST)\r
+X-Queued: (qmail 9941 invoked by alias); 26 Jan 2015 11:04:52 -0000\r
+X-RUB-Notes: Internal\r
+X-Queued: (qmail 9878 invoked by uid 109); 26 Jan 2015 11:04:51 -0000\r
+X-Qmailscanner: from 134.147.42.227 by mx4.rz.ruhr-uni-bochum.de\r
+ (envelope-from <jan.n.klug@rub.de>,\r
+ uid 103) with qmail-scanner-2.01 (clamdscan: 0.98.1/18526. \r
+ Clear:RC:1(134.147.42.227):. \r
+ Processed in 0.0535 secs); 26 Jan 2015 11:04:51 -0000\r
+Received: from mail1.mail.ruhr-uni-bochum.de (134.147.42.227)\r
+ by mx4.rz.ruhr-uni-bochum.de with SMTP; 26 Jan 2015 11:04:51 -0000\r
+Received: from localhost (mobil-13.rubion.ruhr-uni-bochum.de [134.147.65.233])\r
+ by mail1.mail.ruhr-uni-bochum.de (Postfix) with ESMTPSA id 26923200D9\r
+ for <notmuch@notmuchmail.org>; Mon, 26 Jan 2015 12:04:50 +0100 (CET)\r
+From: "Jan N. Klug" <jan.n.klug@rub.de>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] Add support for missing Messsage-ID header\r
+Date: Mon, 26 Jan 2015 12:04:48 +0100\r
+Message-Id: <1422270288-6089-1-git-send-email-jan.n.klug@rub.de>\r
+X-Mailer: git-send-email 2.1.4\r
+X-Virus-Scanned: clamav-milter 0.98.5 at mail1.mail.ruhr-uni-bochum.de\r
+X-Virus-Status: Clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 26 Jan 2015 11:04:56 -0000\r
+\r
+---\r
+ contrib/notmuch-mutt/notmuch-mutt | 14 +++++++++-----\r
+ 1 file changed, 9 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt\r
+index 4969e4b..b9882fd 100755\r
+--- a/contrib/notmuch-mutt/notmuch-mutt\r
++++ b/contrib/notmuch-mutt/notmuch-mutt\r
+@@ -18,7 +18,7 @@ use Mail::Box::Maildir;\r
+ use Pod::Usage;\r
+ use String::ShellQuote;\r
+ use Term::ReadLine;\r
+-\r
++use Digest::SHA qw (sha1_hex);\r
+ \r
+ my $xdg_cache_dir = "$ENV{HOME}/.cache";\r
+ $xdg_cache_dir = $ENV{XDG_CACHE_HOME} if $ENV{XDG_CACHE_HOME};\r
+@@ -75,10 +75,14 @@ sub prompt($$) {\r
+ }\r
+ \r
+ sub get_message_id() {\r
+- my $mail = Mail::Internet->new(\*STDIN);\r
+- my $mid = $mail->head->get("message-id") or return undef;\r
+- $mid =~ /^<(.*)>$/; # get message-id value\r
+- return $1;\r
++ my $mail = Mail::Internet->new(\*STDIN, Modify => 0);\r
++ my $mid = $mail->head->get("message-id");\r
++ if (defined $mid) { # get message-id value\r
++ $mid = $1 if ($mid =~ /^<(.*)>$/); \r
++ } else { # generate synthetic message-id\r
++ $mid = "notmuch-sha1-".sha1_hex($mail->as_string());\r
++ }\r
++ return $mid;\r
+ }\r
+ \r
+ sub search_action($$$@) {\r
+-- \r
+2.1.4\r
+\r