Last active
October 13, 2018 21:08
-
-
Save creichert/40da7e0fe3b23ab11c5298989ec3c7aa to your computer and use it in GitHub Desktop.
gnus multiple nnimap accounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see my config for the other parts: | |
;; | |
;; https://github.com/creichert/dotfiles/blob/master/emacs/.gnus | |
;; | |
;; I typically put the below settings into a file called `gnus-private.el`, | |
;; and require that into my gnus to populate these settings. | |
;; | |
;; https://github.com/creichert/dotfiles/blob/master/emacs/.gnus#L61 | |
;; ~/.authinfo.gpg | |
;; machine second login second@gmail.com password pass3 | |
;; machine third login third@domain.com password pass2 | |
(setq gnus-secondary-select-methods | |
'( | |
(nnimap "second" | |
(nnimap-address "imap.googlemail.com") | |
(nnimap-authinfo-file "~/.authinfo.gpg") | |
(nnimap-stream ssl)) | |
(nnimap "third" | |
(nnimap-address "imap.somedomain.com") | |
(nnimap-authinfo-file "~/.authinfo.gpg") | |
(nnmail-expiry-wait 'never) | |
(nnimap-stream ssl)))) | |
;; To setup "outgoing" address, you need to be aware of a few basics: | |
;; | |
;; - gnus-parameters (these are group parameters and take precedence) | |
;; | |
;; - gnus-topic-parameters (think of topics as simply "fitting over" groups precedence-wise) | |
;; | |
;; WARNING: | |
;; | |
;; The biggest thing to watch out for when sending outgoing mails, is that gnus/message.el tend | |
;; to "replace" the address with your default automatically if everything is not configured correctly. | |
;; | |
;; I DONT use a default `user-mail-address` value. Instead, I ensure it's set properly in all my | |
;; posting-styles, and I'm alerted when it's not. | |
;; | |
;; Additionally, I use the "sendmail-envelope-from", so that my smtp sendmail function, simply | |
;; uses that: https://github.com/creichert/dotfiles/blob/master/emacs/.gnus#L221-L226 | |
(setq | |
;; visible inboxes, helps to enter them to see old mail, if you didn't handle it immediately. | |
;; | |
;; gnus-permanently-visible-groups "^nnimap\\+main:INBOX\\|^nnimap\\+secondary:INBOX" | |
;; default citation styles, do you want ">" (the default) or "gmail" style? | |
;; message-cite-reply-position 'above | |
;; message-cite-style 'message-cite-style-gmail | |
;; when you enter a group and the regexp matches, the parameter is enabled. | |
gnus-parameters | |
'( | |
;; default settings | |
(".*" | |
(large-newsgroup-initial . 20)) | |
;; default imap settings | |
("^nnimap" | |
;; not working, but the idea is to keep headers better in-sync. you'll | |
;; eventually run into a problem (esp. with gmail) that it's hard to access | |
;; old threads. this might need a similar technique as the dynamic | |
;; message-cite-style below. | |
(gnus-fetch-old-headers . some) | |
(expiry-wait . immediate) | |
(expiry-target . delete)) | |
("nnimap\\+second:.*" | |
;; outgoing address when replying in this group. | |
(address . "second@address.com")) | |
;; virtual inbox handling, if that's your thing | |
("nnimap\\+third:\\[Gmail\\]/.*" | |
(display . none) | |
(expiry-wait . never))) | |
;; Set additional posting styles when creating a message. Options specified | |
;; here are overwritten by `gnus-parameters` | |
gnus-posting-styles | |
'( | |
(".*" ;; defaults | |
(name user-full-name) | |
(address "personal@address.com")) | |
("nndraft:.*" | |
(From (with-current-buffer gnus-article-buffer | |
(message-fetch-field "from")))) | |
("nnimap\\+third:" | |
;; smtpmail-send-it support, you need to add this header in your posting-style, | |
;; it will be removed before sending. (i don't know if the "third@address.com" needs | |
;; to be the "from" or the "username", just look that up. | |
;;("X-Message-SMTP-Method" "smtp smtp.server2.com 587 third@address.com") | |
(address . "third@address.com")) | |
((header "Reply-To" ".*@reply.github.com") | |
(address "mygithub@address.com") | |
(signature nil) | |
(mail-citation-hook) | |
(organization nil) | |
;; dynamically set message-cite-style | |
(eval | |
(set (make-local-variable 'message-cite-style) nil)) | |
))) | |
;; The eval-after-load may not be necessary | |
;; | |
;; I set these, but read the docs: | |
;; | |
;; (setq-default gnus-subscribe-options-newsgroup-method 'gnus-subscribe-topics) | |
;; (setq-default gnus-subscribe-newsgroup-method 'gnus-subscribe-topics)) | |
(eval-after-load 'gnus-topic | |
'(progn | |
(setq | |
gnus-topic-topology | |
'(("Gnus" visible nil nil) | |
(("misc" visible nil | |
((subscribe . "nndraft:") | |
(subscribe . "nnfolder:") | |
))) | |
(("main" visible nil | |
((subscribe . "^INBOX")))) | |
(("second" visible nil | |
((subscribe . "nnimap\\+second:") | |
(subscribe-level . 5)))) | |
(("third" visible nil | |
((subscribe . "nnimap\\+third:")))))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment