Re: sending email using different server for different 'From:' field
authorKeith Amidon <camalot@picnicpark.org>
Tue, 2 Sep 2014 14:35:11 +0000 (07:35 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:24 +0000 (10:04 -0800)
94/de65fe7c38c2662da00b5943a32b7c8e05a295 [new file with mode: 0644]

diff --git a/94/de65fe7c38c2662da00b5943a32b7c8e05a295 b/94/de65fe7c38c2662da00b5943a32b7c8e05a295
new file mode 100644 (file)
index 0000000..84bcb0d
--- /dev/null
@@ -0,0 +1,97 @@
+Return-Path: <camalot@picnicpark.org>\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 C79D7431FB6\r
+       for <notmuch@notmuchmail.org>; Tue,  2 Sep 2014 07:42:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 ARbnCYGGjbbI for <notmuch@notmuchmail.org>;\r
+       Tue,  2 Sep 2014 07:41:54 -0700 (PDT)\r
+X-Greylist: delayed 399 seconds by postgrey-1.32 at olra;\r
+       Tue, 02 Sep 2014 07:41:53 PDT\r
+Received: from picnicpark.org (picnicpark.org [130.94.181.238])\r
+       by olra.theworths.org (Postfix) with ESMTP id E75B2431FAF\r
+       for <notmuch@notmuchmail.org>; Tue,  2 Sep 2014 07:41:53 -0700 (PDT)\r
+Received: (qmail 60291 invoked by uid 13806); 2 Sep 2014 14:35:12 -0000\r
+Received: from unknown (HELO gw.picnicpark.org) ([108.225.17.54])\r
+       (envelope-sender <camalot@picnicpark.org>)\r
+       by 130.94.181.238 (qmail-ldap-1.03) with SMTP\r
+       for <david@belohrad.ch>; 2 Sep 2014 14:35:12 -0000\r
+Received: from friend.picnicpark.org (friend.picnicpark.org [192.168.35.1])\r
+       by gw.picnicpark.org (Postfix) with ESMTPSA id DAAF112A0DE7;\r
+       Tue,  2 Sep 2014 07:35:11 -0700 (PDT)\r
+Message-ID: <1409668511.2507.32.camel@picnicpark.org>\r
+Subject: Re: sending email using different server for different 'From:' field\r
+From: Keith Amidon <camalot@picnicpark.org>\r
+To: David Belohrad <david@belohrad.ch>\r
+Date: Tue, 02 Sep 2014 07:35:11 -0700\r
+In-Reply-To: <uaxzjei1a4j.fsf@beesknees.cern.ch>\r
+References: <uaxzjei1a4j.fsf@beesknees.cern.ch>\r
+Content-Type: text/plain; charset="UTF-8"\r
+X-Mailer: Evolution 3.12.5 \r
+Mime-Version: 1.0\r
+Content-Transfer-Encoding: 7bit\r
+Cc: notmuch@notmuchmail.org\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: Tue, 02 Sep 2014 14:42:02 -0000\r
+\r
+On Tue, 2014-09-02 at 14:26 +0200, David Belohrad wrote:\r
+> could that scenario be somehow fitted automatically, so when I overwrite\r
+> the default 'From:' address (by hand. is it possible to do some\r
+> automatic cycling?) to work address, so that message sender in emacs\r
+> would automatically use work exchange server to deliver the mail?\r
+\r
+I think this is more of a message-mode question than a notmuch question.\r
+I use something very similar to code attached below, which is rather\r
+brute-force, but does the job for me.\r
+\r
+             --- Keith\r
+\r
+-----\r
+\r
+(defun kea/send-mail-with-x ()\r
+  (interactive)\r
+  (setq smtpmail-smtp-server "smtp.x.com"\r
+        smtpmail-smtp-service 587\r
+        smtpmail-local-domain "x.com"\r
+        smtpmail-auth-user nil\r
+        smtpmail-stream-type 'starttls))\r
+\r
+(defun kea/send-mail-with-y ()\r
+  (interactive)\r
+  (setq smtpmail-smtp-server "email.y.com"\r
+        smtpmail-smtp-service 587\r
+        smtpmail-local-domain "y.com"\r
+        smtpmail-auth-user nil\r
+        smtpmail-stream-type 'starttls))\r
+\r
+(defun kea/message-select-mail-dest ()\r
+  (cond ((string-match "<kea@x.com>"\r
+                       (message-field-value "From"))\r
+         (kea/send-mail-with-x))\r
+        (t\r
+         (kea/send-mail-with-y))))\r
+\r
+(kea/send-mail-with-y)\r
+(add-hook 'message-send-hook 'kea/message-select-mail-dest)\r
+\r
+\r
+\r