Commit | Line | Data |
---|---|---|
5252f79a MW |
1 | ;;; -*-emacs-lisp-*- |
2 | ;;; | |
3 | ;;; Local GNUS configuration -- distorted.org.uk version | |
4 | ;;; | |
5 | ;;; (c) 2014 Mark Wooding | |
6 | ;;; | |
7 | ||
e6395174 MW |
8 | (setq auth-sources '("~/.authinfo.gpg") |
9 | gnus-cloud-method "nnimap:distorted") | |
df5a4ca5 | 10 | |
5252f79a | 11 | ;;;-------------------------------------------------------------------------- |
789a48fe MW |
12 | ;;; How to send mail. |
13 | ||
24da4184 | 14 | (setq smtpmail-smtp-service 587 |
8f69bcd5 | 15 | smtpmail-auth-credentials "~/.authinfo.gpg") |
24da4184 MW |
16 | |
17 | (setq mdw-send-mail-alist | |
18 | `((distorted-smtp | |
19 | (send-mail-function . smtpmail-send-it) | |
20 | (smtpmail-smtp-server . "mail.distorted.org.uk") | |
21 | (smtpmail-starttls-credentials | |
22 | ("mail.distorted.org.uk" 587 nil nil))) | |
23 | (chiark-smtp | |
24 | (send-mail-function . smtpmail-send-it) | |
25 | (smtpmail-smtp-server . "smtp.dovecot.chiark.greenend.org.uk") | |
26 | (starttls-extra-arguments "--insecure") | |
27 | (smtpmail-starttls-credentials | |
28 | ("smtp.dovecot.chiark.greenend.org.uk" 587 nil nil))) | |
29 | (gmail-smtp | |
30 | (send-mail-function . smtpmail-send-it) | |
31 | (smtpmail-smtp-server . "smtp.gmail.com") | |
32 | (smtpmail-starttls-credentials | |
33 | ("smtp.gmail.com" 587 nil nil)))) | |
34 | mdw-guess-send-mail-alist | |
35 | `((,(concat "@\\(" "\\(chiark\\|slimy\\|coriolis\\)" | |
36 | "\\.greenend\\.org\\.uk" | |
37 | "\\|" "evade\\.org\\.uk" | |
38 | "\\|" "fyvzl\\.net" | |
39 | "\\)$") . chiark-smtp) | |
b5d9e1c8 | 40 | ("@g\\(oogle\\)?mail\\.com$" . gmail-smtp)) |
24da4184 | 41 | mdw-default-send-mail-method nil) |
789a48fe MW |
42 | |
43 | ;;;-------------------------------------------------------------------------- | |
f240cfd7 MW |
44 | ;;; News via chiark. |
45 | ||
46 | ;; Currently we assume an SSH tunnel. This will be fixed later. | |
47 | (setq gnus-select-method | |
48 | '(nntp "chiark-ssh-kludge" | |
49 | (nntp-open-connection-function nntp-open-authinfo-kludge) | |
df38b85d MW |
50 | (nntp-address "tunnel.chiark.greenend.org.uk") |
51 | (nntp-authinfo-generic "md5cookie1way mdw"))) | |
f240cfd7 MW |
52 | |
53 | ;;;-------------------------------------------------------------------------- | |
5252f79a MW |
54 | ;;; Mail group configuration. |
55 | ||
56 | ;; General splitting configuration. | |
90ad62cd | 57 | (setq nnimap-split-rule 'nnimap-split-fancy |
4fb653fd | 58 | nnmail-split-methods 'nnmail-split-fancy |
5252f79a | 59 | nnimap-split-predicate "UNDELETED" |
4fb653fd MW |
60 | nnimap-split-crosspost t |
61 | nnmail-split-crosspost t | |
5252f79a MW |
62 | nnmail-split-fancy-match-partial-words nil) |
63 | ||
64 | ;; Automatic expiry for particular groups. | |
65 | (setq gnus-auto-expirable-newsgroups | |
40a3fc1d MW |
66 | (concat "^" |
67 | "\\(nnimap\\+[^:]+\\|nnvirtual\\):" | |
9ee82fbb | 68 | "\\(" "\\(admin\\|crap\\|lists\\|nag\\)\\." |
9dbc618b MW |
69 | "\\|" "spam\\.oubliette" |
70 | "\\)")) | |
5252f79a | 71 | |
277521fa | 72 | ;; My various email addresses. |
43026cf3 | 73 | (setq message-alternative-emails bbdb-user-mail-names |
277521fa MW |
74 | message-dont-reply-to-names message-alternative-emails) |
75 | ||
f8d935ae | 76 | ;; Augment Gnus's built-in header-list abbreviations. |
db6e1e36 | 77 | (require 'nnmail) |
15efe2bc MW |
78 | (setq nnmail-split-abbrev-alist |
79 | (mdw-uniquify-alist | |
80 | `((to . ,(concat "to\\|cc\\|apparently-to\\|envelope-to\\|" | |
81 | "resent-to\\|resent-cc")) | |
82 | (any . ,(concat "from\\|sender\\|resent-from\\|" | |
83 | "to\\|cc\\|apparently-to\\|envelope-to\\|" | |
84 | "resent-to\\|resent-cc")) | |
85 | ,@nnmail-split-abbrev-alist))) | |
86 | ||
ecfc1766 | 87 | ;; Find out about my `odin.gg' mappings. |
093f5ffa MW |
88 | (defvar mdw-odin-parse-regexp |
89 | (concat "^" | |
90 | "\\S-+" "\\s-+" ; time limit | |
91 | "\\(" "\\S-+" "\\)" "\\s-+" ; local part | |
92 | "\\S-+" "\\s-+" ; recipient email address | |
93 | "=" "\\(" "\\S-+" "\\)" ; mailbox tag | |
94 | "\\(" "$" "\\|" "\\s-" "\\)")) | |
95 | ||
53d6b45c | 96 | (defvar mdw-odin-splits nil) |
1e3bad21 | 97 | (defvar mdw-odin-sender-alist nil) |
53d6b45c MW |
98 | |
99 | (defun mdw-update-odin-info () | |
1e3bad21 | 100 | (let ((splits nil) (senders nil)) |
093f5ffa MW |
101 | (with-temp-buffer |
102 | (call-process "ssh" nil t nil | |
103 | "stratocaster" "userv" "odin" "mail" "list") | |
104 | (goto-char (point-min)) | |
105 | (while (< (point) (point-max)) | |
106 | (when (looking-at mdw-odin-parse-regexp) | |
107 | (let ((local-part (match-string 1)) | |
108 | (tag (match-string 2))) | |
109 | (push `(to ,(format "%s@odin\\.gg" local-part) | |
110 | ,(format "crap.%s" tag)) | |
1e3bad21 MW |
111 | splits) |
112 | (push (cons tag local-part) senders))) | |
093f5ffa | 113 | (forward-line))) |
1e3bad21 MW |
114 | (setq mdw-odin-splits (nreverse splits) |
115 | mdw-odin-sender-alist (nreverse senders)))) | |
53d6b45c | 116 | (mdw-update-odin-info) |
093f5ffa | 117 | |
7f526fc6 MW |
118 | ;; Mail sent to `mdw-nospam-THING' should appear to come from this address. |
119 | (setq gnus-posting-styles | |
120 | '(("^nnimap\\+distorted:crap\\." | |
1fe0e9b3 MW |
121 | (address (let* ((mailbox (substring gnus-newsgroup-name |
122 | (match-end 0))) | |
123 | (entry (assoc mailbox mdw-odin-sender-alist))) | |
1e3bad21 MW |
124 | (if entry (concat (cdr entry) "@odin.gg") |
125 | (concat "mdw-nospam-" mailbox "@distorted.org.uk"))))) | |
7f526fc6 MW |
126 | ("^nnimap\\+[^:]+-chiark:" |
127 | ("X-mdw-Send-Mail" "chiark-smtp")) | |
128 | ("^nnimap\\+google:" | |
129 | (address "distorted.mdw@gmail.com") | |
130 | ("X-mdw-Send-Mail" "gmail-smtp")))) | |
131 | ||
5252f79a | 132 | ;; The actual splitting rules. |
4fb653fd | 133 | (setq nnmail-split-fancy |
093f5ffa | 134 | `(| |
a27bd871 | 135 | ;; Administrative boxes. |
a93d1938 MW |
136 | (to "\\<\\(root\\|postgres\\|ca\\|noc\\)@" "admin.misc" t) |
137 | (to "\\<\\(jukebox\\|nobody\\|darchive\\)@" "admin.misc" t) | |
138 | (to "\\<\\(hostmaster\\)@" "admin.dns" t) | |
139 | (to "\\<\\(news\\|newsmaster\\|usenet\\)@" "admin.news" t) | |
140 | (to "\\<\\(postmaster\\|spamd\\|mailer-daemon\\)@" "admin.mail" t) | |
ef9bb585 | 141 | (to "\\<\\(mailman-owner\\)@" "admin.mail" t) |
a93d1938 MW |
142 | (to "\\<\\(irc\\|blight\\|ircbot\\)@" "admin.irc" t) |
143 | (to "\\<\\(www\\|webmaster\\|mtos\\)@" "admin.web" t) | |
144 | (to "\\<\\(ftp\\|ftpadmin\\|mirror\\)@" "admin.ftp" t) | |
145 | (to "\\\<\\(abuse\\|security\\)@" "admin.keep" t) | |
a27bd871 MW |
146 | (from "cron daemon" "admin.misc") |
147 | (from "uucp@distorted\\.org\\.uk" "admin.uucp") | |
148 | (from "darchive@.*\\.distorted\\.org\\.uk" "admin.misc") | |
0e1d5f0a | 149 | (from "sales@aa\\.net\\.uk" "admin.aaisp") |
51fb1b09 | 150 | (from "support@aa\\.net\\.uk" "admin.aaisp") |
d268047a | 151 | (from "bugs@distorted\\.org\\.uk" "admin.bugs") |
a9c07f72 | 152 | (from "darchive@distorted\\.org\\.uk" "admin.darchive") |
a27bd871 | 153 | |
a9c07f72 | 154 | ;; Colo and network provider. |
a27bd871 | 155 | (from "\\(accounts\\|support\\)@jump\\.net\\.uk" "keep.colo") |
a9c07f72 | 156 | (from "\\(accounts\\|support\\)@aa\\.net\\.uk" "keep.aaisp") |
a27bd871 MW |
157 | |
158 | ;; Mailing lists, not split out earlier. | |
5252f79a | 159 | (to "python-list@python\\.org" "lists.python") |
e3eb6fe0 | 160 | (to ,(concat "\\(jump-\\(announce\\|discuss\\|vps\\)\\)@" |
b5d9e1c8 | 161 | "\\(lists\\.\\)?" "jump\\.net\\.uk") |
a9c07f72 | 162 | "lists.\\1") |
272f4216 MW |
163 | (to "cambridgecryptowhiskyclub@gmail\\.com" |
164 | "lists.cambridge-crypto-whisky") | |
a9c07f72 MW |
165 | (from ,(concat "@" "\\(" "liberty-human-rights" |
166 | "\\|" "libertyhumanrights" | |
167 | "\\|" "libertymail" | |
168 | "\\)" "\\.org\\.uk" "\\>") | |
169 | "lists.liberty" t) | |
10e55928 | 170 | (from "@openrightsgroup\\.org\\>" "lists.org" t) |
a9c07f72 MW |
171 | (from "@warwick\\.ac\\.uk\\>" "lists.warwick-uni" t) |
172 | (to "chiark-\\(motd\\|announce\\)@chiark\\.greenend\\.org\\.uk" | |
173 | "lists.chiark-announce") | |
e3eb6fe0 | 174 | (to "sot@dotat\\.at" "lists.sot" t) |
a9c07f72 | 175 | (any "clive-cambridge-gamers@nsict\\.org" "lists.nsict-games") |
a27bd871 MW |
176 | |
177 | ;; Per-sender addresses. | |
a93d1938 MW |
178 | (to "\\<mdw-nospam-justgviing@" "crap.justgiving" t) |
179 | (to "\\<mdw-nospam-\\([^@]+\\)@" "crap.\\1" t) | |
180 | (to "\\<mdw-nopspam-\\([^@]+\\)@" "crap.\\1" t) | |
a27bd871 | 181 | |
093f5ffa | 182 | (to "\\(markw\\|mdw\\|mw\\)@odin\\.gg" "mail.misc") |
53d6b45c | 183 | ,@mdw-odin-splits |
093f5ffa MW |
184 | (to "\\([a-z0-9]+\\)@odin\\.gg" "crap.odin-misc") |
185 | ||
a27bd871 | 186 | ;; Regular nags. |
5252f79a MW |
187 | (from "\\(sealbot\\|cardbot\\)@ncipher\\.com" "nag.cardbot") |
188 | (from "\\<mailman-owner@" "nag.mailman" t) | |
a27bd871 | 189 | |
48c5ccb3 | 190 | ;; Uninteresting mail. |
10e55928 | 191 | (from "expiry@letsencrypt\\.org" "admin.letsencrypt") |
48c5ccb3 | 192 | |
a27bd871 | 193 | ;; Other splits I've not given a per-sender address. |
e3eb6fe0 | 194 | (from "@\\([^.]+\\.\\)?aegon" "crap.aegon" t) |
b5d9e1c8 | 195 | (from "@\\(.*\\.\\)?amazon\\." "crap.amazon" t) |
e3eb6fe0 | 196 | (from "@\\(.*\\.\\)?primevideo\\." "crap.amazon" t) |
10e55928 | 197 | (from "@cineworldmail\\.com\\>" "crap.cineworld" t) |
eba46687 MW |
198 | (from "unlimited@cineworld\\.com\\>" "crap.cineworld" t) |
199 | (from "@\\(.*\\.\\)?gandi\\.net\\>" "crap.gandi" t) | |
200 | (from "@accounts\\.google\\.com\\>" "crap.google" t) | |
201 | (from "campaigns@jolla\\.com\\>" "crap.jolla" t) | |
202 | (from "@\\(.*\\.\\)?lovefilm\\.com\\>" "crap.lovefilm" t) | |
203 | (from "@mythic-beasts\\.com\\>" "crap.mythic-beasts" t) | |
e3eb6fe0 | 204 | (from "@\\([^.]+\\.\\)?nationwide" "crap.nationwide" t) |
10e55928 | 205 | (from "nationwide@securesuiteemail\\.com\\>" "crap.nationwide" t) |
10e55928 | 206 | (from "@action\\.openrightsgroup\\.org\\>" "crap.org" t) |
eba46687 MW |
207 | (from "@picturehouses\\.co\\.uk\\>" "crap.picturehouse" t) |
208 | (from "@\\(.*\\.\\)?spotify\\(mail\\)?\\.com\\>" "crap.spotify" t) | |
a9c07f72 | 209 | (from "@thomann\\.de\\>" "crap.thomann" t) |
eba46687 | 210 | (from "@tshirthell\\.com\\>" "crap.tshirt-hell" t) |
a9c07f72 | 211 | (from "@wikimedia\\.org\\>" "crap.wikimedia" t) |
a27bd871 MW |
212 | |
213 | ;; Default. | |
90ad62cd | 214 | "mail.misc")) |
5252f79a | 215 | |
c77d8eb0 MW |
216 | ;;;-------------------------------------------------------------------------- |
217 | ;;; Where we get mail from. | |
218 | ||
219 | ;; Read mail on the IMAP server. | |
220 | (setq gnus-secondary-select-methods | |
90ad62cd | 221 | `((nnimap "distorted" |
c77d8eb0 | 222 | (nnimap-address "mail.distorted.org.uk") |
591be324 | 223 | (nnimap-user "mdw") |
c77d8eb0 | 224 | (nnimap-stream starttls) |
90ad62cd MW |
225 | (nnimap-inbox ("INBOX" "to.split")) |
226 | (nnimap-split-methods nnimap-split-fancy) | |
227 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 MW |
228 | (nnimap-unsplittable-articles (%Deleted))) |
229 | (nnimap "markw-distorted" | |
230 | (nnimap-address "mail.distorted.org.uk") | |
591be324 | 231 | (nnimap-user "markw") |
c77d8eb0 | 232 | (nnimap-stream starttls) |
90ad62cd MW |
233 | (nnimap-inbox ("INBOX" "to.split")) |
234 | (nnimap-split-methods nnimap-split-fancy) | |
235 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 | 236 | (nnimap-unsplittable-articles (%Deleted))) |
49518b49 MW |
237 | (nnimap "mdw-chiark" |
238 | (nnimap-address "imap.dovecot.chiark.greenend.org.uk") | |
591be324 | 239 | (nnimap-user "mdw") |
49518b49 MW |
240 | (nnimap-stream starttls) |
241 | (nnimap-inbox ("INBOX" "to.split")) | |
242 | (nnimap-split-methods nnimap-split-fancy) | |
243 | (nnimap-split-fancy ,nnmail-split-fancy) | |
244 | (nnimap-unsplittable-articles (%Deleted))) | |
c77d8eb0 MW |
245 | (nnimap "mwooding-chiark" |
246 | (nnimap-address "imap.dovecot.chiark.greenend.org.uk") | |
591be324 | 247 | (nnimap-user "mwooding") |
c77d8eb0 | 248 | (nnimap-stream starttls) |
6bba3b24 MW |
249 | (nnimap-inbox ("INBOX" "to.split")) |
250 | (nnimap-split-methods nnimap-split-fancy) | |
251 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 MW |
252 | (nnimap-unsplittable-articles (%Deleted))) |
253 | (nnimap "google" | |
254 | (nnimap-address "imap.gmail.com") | |
255 | (nnimap-stream tls) | |
6bba3b24 MW |
256 | (nnimap-inbox ("INBOX" "to.split")) |
257 | (nnimap-split-methods nnimap-split-fancy) | |
258 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 MW |
259 | (nnimap-unsplittable-articles (%Deleted))))) |
260 | ||
261 | ;; Send sent mail back to me. | |
262 | (setq gnus-message-archive-method "mail" | |
263 | gnus-gcc-mark-as-read t | |
264 | gnus-message-archive-group "nnimap+distorted:mail.sent") | |
265 | ||
5252f79a | 266 | ;;;----- That's all, folks -------------------------------------------------- |