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