From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85069 Path: news.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.gnus.general Subject: multiple mail accounts in Gnus Date: Thu, 02 Oct 2014 18:48:48 +0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412261426 24533 80.91.229.3 (2 Oct 2014 14:50:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Oct 2014 14:50:26 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33313@lists.math.uh.edu Thu Oct 02 16:50:21 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XZhi0-0001YU-8c for ding-account@gmane.org; Thu, 02 Oct 2014 16:50:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1XZhgf-00047X-OG; Thu, 02 Oct 2014 09:48:57 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1XZhgd-000475-Kz for ding@lists.math.uh.edu; Thu, 02 Oct 2014 09:48:55 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1XZhgc-0006Vj-2l for ding@lists.math.uh.edu; Thu, 02 Oct 2014 09:48:55 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XZhga-0008MS-6H for ding@gnus.org; Thu, 02 Oct 2014 16:48:52 +0200 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by gateway2.nyi.internal (Postfix) with ESMTP id 65540209A3 for ; Thu, 2 Oct 2014 10:48:51 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Thu, 02 Oct 2014 10:48:51 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= x-sasl-enc:from:to:subject:date:message-id:mime-version :content-type; s=mesmtp; bh=bl7Rc1FyB+0Pu5i4GomS0E4kMh8=; b=ktOw lRyhFMvgP+ww8FZyDT69fL+6k1ekKx7UkXgeyinlUZF88my5/NXA0PxRT4XMks0K POAViJYTZ29du4batdC4wZ7DY3OmO0ZTw/UcbqFm+csAjXqsSeWmgQDpmuHSZU9E SFwu308K0UXWeIh0L2pRriHuAx7natTuaIv5ntk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:subject:date :message-id:mime-version:content-type; s=smtpout; bh=bl7Rc1FyB+0 Pu5i4GomS0E4kMh8=; b=Ek0OTE44Zph12P6otmJpXDVsKqtWptP/UyXVeWWoX6q Kz7yEaemzWTjz4rzTLvI/MVo0Gt3vLI6zenZTYHDrFdTfUblZHneaF/wAVkGXzpx t8pZu/QnnxY3TVjfSPF6MSfeLMfd7CYezTUKvvFZYVvgujFFY7ULAcghKqe8MZA0 = X-Sasl-enc: nqZiE1V5bPf1IOhJVTnKw+YTFB7aMg19bpclUxJK3y69 1412261331 Original-Received: from Filipps-Lovely-Macbook.local (unknown [94.25.218.10]) by mail.messagingengine.com (Postfix) with ESMTPA id F085BC00006 for ; Thu, 2 Oct 2014 10:48:50 -0400 (EDT) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85069 Archived-At: Here's my solution to the problem. I'm not sure I'm doing it right. Perhaps somebody could suggest me a better option. I have two accounts - one private and one for work. 1) Get mail from both (setq gnus-select-method '(nnnil "")) ; turn off primary select method (setq gnus-secondary-select-methods '((nnml ""))) ; only mail here (setq mail-sources '((imap :server "mail.messagingengine.com" :user "fgunbin@fastmail.fm" :stream ssl :mailbox "Inbox") (imap :server "outlook.office365.com" :user "fgunbin@playteam.ru" :stream ssl))) In combination with nnmail-split-methods this downloads and spreads new emails over several nnml groups. 2) Default address and smtp server (setq smtpmail-smtp-server "mail.messagingengine.com" smtpmail-smtp-service 587 user-mail-address "fgunbin@fastmail.fm") 3) Answering to emails (setq gnus-posting-styles '((".*" (address "fgunbin@fastmail.fm") ("X-Message-SMTP-Method" "smtp mail.messagingengine.com 587")) ("nnml:mail.okko" (address "fgunbin@okko.tv") ("X-Message-SMTP-Method" "smtp outlook.office365.com 587")))) This sets appropriate address and SMTP server for a group I'm replying from. All work emails are splitted into a single group: nnml:mail.okko, so we are overriding only for that group. Before I had also this setting, but it seems to be useless with the posting styles configuration above. (setq message-alternative-emails "fgunbin@\\(fastmail.fm\\|okko.tv\\)") 4) Composing new email This is awkward: (defun select-mail-address (&optional to subject other-headers continue switch-function yank-action send-actions return-action) "Advice that sets the mail address to use" (let ((domain (completing-read "From: " '("okko.tv" "fastmail.fm") nil t))) (setq user-mail-address (concat "fgunbin@" domain)))) (advice-add 'compose-mail :before #'select-mail-address) As written, it _sets_ the user-mail-address to be used from now on. Other methods for starting message composition may not call compose-mail and so this hook may not work there. SMTP server could also be set here, but generally I don't care much which server I'm using. -- Filipp