Merge branch 'master' of https://git.distorted.org.uk/~mdw/profile
[profile] / dot / gnus-local.el.distorted
1 ;;; -*-emacs-lisp-*-
2 ;;;
3 ;;; Local GNUS configuration -- distorted.org.uk version
4 ;;;
5 ;;; (c) 2014 Mark Wooding
6 ;;;
7
8 ;;;--------------------------------------------------------------------------
9 ;;; How to send mail.
10
11 (setq smtpmail-smtp-service 587
12 smtpmail-auth-credentials "~/.gnus.authinfo")
13
14 (setq mdw-send-mail-alist
15 `((distorted-smtp
16 (send-mail-function . smtpmail-send-it)
17 (smtpmail-smtp-server . "mail.distorted.org.uk")
18 (smtpmail-starttls-credentials
19 ("mail.distorted.org.uk" 587 nil nil)))
20 (chiark-smtp
21 (send-mail-function . smtpmail-send-it)
22 (smtpmail-smtp-server . "smtp.dovecot.chiark.greenend.org.uk")
23 (starttls-extra-arguments "--insecure")
24 (smtpmail-starttls-credentials
25 ("smtp.dovecot.chiark.greenend.org.uk" 587 nil nil)))
26 (gmail-smtp
27 (send-mail-function . smtpmail-send-it)
28 (smtpmail-smtp-server . "smtp.gmail.com")
29 (smtpmail-starttls-credentials
30 ("smtp.gmail.com" 587 nil nil))))
31 mdw-guess-send-mail-alist
32 `((,(concat "@\\(" "\\(chiark\\|slimy\\|coriolis\\)"
33 "\\.greenend\\.org\\.uk"
34 "\\|" "evade\\.org\\.uk"
35 "\\|" "fyvzl\\.net"
36 "\\)$") . chiark-smtp)
37 ("@g\\(\\|oogle\\)mail\\.com$" . gmail-smtp))
38 mdw-default-send-mail-method nil)
39
40 ;;;--------------------------------------------------------------------------
41 ;;; News via chiark.
42
43 ;; Currently we assume an SSH tunnel. This will be fixed later.
44 (setq gnus-select-method
45 '(nntp "chiark-ssh-kludge"
46 (nntp-open-connection-function nntp-open-authinfo-kludge)
47 (nntp-address "tunnel.chiark.greenend.org.uk")
48 (nntp-authinfo-generic "md5cookie1way mdw")))
49
50 ;;;--------------------------------------------------------------------------
51 ;;; Where we get mail from.
52
53 ;; Read mail on the IMAP server.
54 (setq gnus-secondary-select-methods
55 '((nnimap "distorted"
56 (nnimap-address "mail.distorted.org.uk")
57 (nnimap-stream tls)
58 (nnimap-authinfo-file "~/.gnus.authinfo"))
59 (nnimap "markw-distorted"
60 (nnimap-address "mail.distorted.org.uk")
61 (nnimap-stream tls)
62 (nnimap-authinfo-file "~/.gnus.authinfo.markw"))
63 (nnimap "mwooding-chiark"
64 (nnimap-address "imap.dovecot.chiark.greenend.org.uk")
65 (nnimap-stream tls)
66 (nnimap-authinfo-file "~/.gnus.authinfo"))
67 (nnimap "google"
68 (nnimap-address "imap.gmail.com")
69 (nnimap-stream tls)
70 (nnimap-authinfo-file "~/.gnus.authinfo"))))
71
72 ;; Send sent mail back to me.
73 (setq gnus-message-archive-method "mail"
74 gnus-gcc-mark-as-read t
75 gnus-message-archive-group "nnimap+distorted:mail.sent")
76
77 ;;;--------------------------------------------------------------------------
78 ;;; Mail group configuration.
79
80 ;; General splitting configuration.
81 (setq nnimap-split-inbox '("INBOX" "to.split")
82 nnimap-split-rule 'nnimap-split-fancy
83 nnimap-split-methods 'nnimap-split-fancy
84 nnmail-split-methods 'nnmail-split-fancy
85 nnimap-split-predicate "UNDELETED"
86 nnimap-split-crosspost t
87 nnmail-split-crosspost t
88 nnmail-split-fancy-match-partial-words nil)
89
90 ;; Automatic expiry for particular groups.
91 (setq gnus-auto-expirable-newsgroups
92 (concat "^"
93 "\\(nnimap\\+[^:]+\\|nnvirtual\\):"
94 "\\(admin\\|crap\\|lists\\|nag\\|spam\\)\\."))
95
96 ;; My various email addresses.
97 (setq message-alternative-emails bbdb-user-mail-names
98 message-dont-reply-to-names message-alternative-emails)
99
100 ;; Mail sent to `mdw-nospam-THING' should appear to come from this address.
101 (setq gnus-posting-styles
102 '(("^nnimap\\+distorted:crap\\."
103 (address (concat "mdw-nospam-"
104 (substring gnus-newsgroup-name (match-end 0))
105 "@distorted.org.uk")))
106 ("^nnimap\\+[^:]+-chiark:"
107 ("X-mdw-Send-Mail" "chiark-smtp"))
108 ("^nnimap\\+google:"
109 (address "distorted.mdw@gmail.com")
110 ("X-mdw-Send-Mail" "gmail-smtp"))))
111
112 ;; The actual splitting rules.
113 (setq nnmail-split-fancy
114 '(|
115 ;; Administrative boxes.
116 (to "\\(root\\|postgres\\|ca\\|noc\\)@" "admin.misc" t)
117 (to "\\(jukebox\\|nobody\\|darchive\\)@" "admin.misc" t)
118 (to "\\(hostmaster\\)@" "admin.dns" t)
119 (to "\\(news\\|newsmaster\\|usenet\\)@" "admin.news" t)
120 (to "\\(postmaster\\|spamd\\|mailer-daemon\\)@" "admin.mail" t)
121 (to "\\(irc\\|blight\\|ircbot\\)@" "admin.irc" t)
122 (to "\\(www\\|webmaster\\|mtos\\)@" "admin.web" t)
123 (to "\\(ftp\\|ftpadmin\\|mirror\\)@" "admin.ftp" t)
124 (to "\\(abuse\\|security\\)@" "admin.keep" t)
125 (from "cron daemon" "admin.misc")
126 (from "uucp@distorted\\.org\\.uk" "admin.uucp")
127 (from "darchive@.*\\.distorted\\.org\\.uk" "admin.misc")
128 (from "bugs@distorted\\.org\\.uk" "admin.bugs")
129
130 ;; Colo provider.
131 (from "\\(accounts\\|support\\)@jump\\.net\\.uk" "keep.colo")
132
133 ;; Mailing lists, not split out earlier.
134 (to "python-list@python\\.org" "lists.python")
135 (to "jump-announce@jump\\.net\\.uk" "lists.jump-announce")
136
137 ;; Per-sender addresses.
138 (to "mdw-nospam-justgviing@" "crap.justgiving" t)
139 (to "mdw-nospam-\\([^@]+\\)@" "crap.\\1" t)
140 (to "mdw-nopspam-\\([^@]+\\)@" "crap.\\1" t)
141
142 ;; Regular nags.
143 (from "\\(sealbot\\|cardbot\\)@ncipher\\.com" "nag.cardbot")
144 (from "\\<mailman-owner@" "nag.mailman" t)
145
146 ;; Uninteresting mail.
147 (from "expiry@letsencrypt\\.org" "spam.letsencrypt" t)
148
149 ;; Other splits I've not given a per-sender address.
150 (from "@\\(.*\\.\\)?lovefilm\\.com" "spam.lovefilm" t)
151 (from "@amazon\\." "spam.amazon" t)
152 (from "@cineworldmail\\.com" "spam.cineworld" t)
153 (from "@picturehouses\\.co\\.uk" "spam.picturehouse" t)
154 (from "@nationwide" "spam.nationwide" t)
155 (from "@news\\.spotifymail\\.com" "spam.spotify" t)
156 (from "@action\\.openrightsgroup\\.org" "spam.org" t)
157 (from "unlimited@cineworld\\.com" "spam.cineworld" t)
158 (from "nationwide@securesuiteemail\\.com" "spam.nationwide" t)
159 (from "@liberty-human-rights\\.org\\.uk" "spam.liberty" t)
160 (from "@libertymail\\.org\\.uk" "spam.liberty" t)
161 (from "@openrightsgroup\\.org" "spam.org" t)
162 (from "@tshirthell\\.com" "spam.tshirt-hell" t)
163 (from "campaigns@jolla\\.com" "crap.jolla" t)
164
165 ;; Default.
166 "mail.misc")
167 nnimap-split-fancy nnmail-split-fancy)
168
169 ;;;----- That's all, folks --------------------------------------------------