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