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 | ||
df5a4ca5 MW |
8 | (setq auth-sources '("~/.gnus.authinfo")) |
9 | ||
5252f79a | 10 | ;;;-------------------------------------------------------------------------- |
789a48fe MW |
11 | ;;; How to send mail. |
12 | ||
24da4184 MW |
13 | (setq smtpmail-smtp-service 587 |
14 | smtpmail-auth-credentials "~/.gnus.authinfo") | |
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) | |
39 | ("@g\\(\\|oogle\\)mail\\.com$" . gmail-smtp)) | |
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 | ||
5252f79a MW |
75 | ;; Mail sent to `mdw-nospam-THING' should appear to come from this address. |
76 | (setq gnus-posting-styles | |
63bc8fd4 MW |
77 | '(("^nnimap\\+distorted:crap\\." |
78 | (address (concat "mdw-nospam-" | |
79 | (substring gnus-newsgroup-name (match-end 0)) | |
24da4184 MW |
80 | "@distorted.org.uk"))) |
81 | ("^nnimap\\+[^:]+-chiark:" | |
82 | ("X-mdw-Send-Mail" "chiark-smtp")) | |
83 | ("^nnimap\\+google:" | |
84 | (address "distorted.mdw@gmail.com") | |
85 | ("X-mdw-Send-Mail" "gmail-smtp")))) | |
5252f79a | 86 | |
db6e1e36 | 87 | (require 'nnmail) |
15efe2bc MW |
88 | (setq nnmail-split-abbrev-alist |
89 | (mdw-uniquify-alist | |
90 | `((to . ,(concat "to\\|cc\\|apparently-to\\|envelope-to\\|" | |
91 | "resent-to\\|resent-cc")) | |
92 | (any . ,(concat "from\\|sender\\|resent-from\\|" | |
93 | "to\\|cc\\|apparently-to\\|envelope-to\\|" | |
94 | "resent-to\\|resent-cc")) | |
95 | ,@nnmail-split-abbrev-alist))) | |
96 | ||
093f5ffa MW |
97 | (defvar mdw-odin-parse-regexp |
98 | (concat "^" | |
99 | "\\S-+" "\\s-+" ; time limit | |
100 | "\\(" "\\S-+" "\\)" "\\s-+" ; local part | |
101 | "\\S-+" "\\s-+" ; recipient email address | |
102 | "=" "\\(" "\\S-+" "\\)" ; mailbox tag | |
103 | "\\(" "$" "\\|" "\\s-" "\\)")) | |
104 | ||
105 | (defun mdw-odin-splits () | |
106 | (let ((list nil)) | |
107 | (with-temp-buffer | |
108 | (call-process "ssh" nil t nil | |
109 | "stratocaster" "userv" "odin" "mail" "list") | |
110 | (goto-char (point-min)) | |
111 | (while (< (point) (point-max)) | |
112 | (when (looking-at mdw-odin-parse-regexp) | |
113 | (let ((local-part (match-string 1)) | |
114 | (tag (match-string 2))) | |
115 | (push `(to ,(format "%s@odin\\.gg" local-part) | |
116 | ,(format "crap.%s" tag)) | |
117 | list))) | |
118 | (forward-line))) | |
119 | (nreverse list))) | |
120 | ||
5252f79a | 121 | ;; The actual splitting rules. |
4fb653fd | 122 | (setq nnmail-split-fancy |
093f5ffa | 123 | `(| |
a27bd871 | 124 | ;; Administrative boxes. |
a93d1938 MW |
125 | (to "\\<\\(root\\|postgres\\|ca\\|noc\\)@" "admin.misc" t) |
126 | (to "\\<\\(jukebox\\|nobody\\|darchive\\)@" "admin.misc" t) | |
127 | (to "\\<\\(hostmaster\\)@" "admin.dns" t) | |
128 | (to "\\<\\(news\\|newsmaster\\|usenet\\)@" "admin.news" t) | |
129 | (to "\\<\\(postmaster\\|spamd\\|mailer-daemon\\)@" "admin.mail" t) | |
130 | (to "\\<\\(irc\\|blight\\|ircbot\\)@" "admin.irc" t) | |
131 | (to "\\<\\(www\\|webmaster\\|mtos\\)@" "admin.web" t) | |
132 | (to "\\<\\(ftp\\|ftpadmin\\|mirror\\)@" "admin.ftp" t) | |
133 | (to "\\\<\\(abuse\\|security\\)@" "admin.keep" t) | |
a27bd871 MW |
134 | (from "cron daemon" "admin.misc") |
135 | (from "uucp@distorted\\.org\\.uk" "admin.uucp") | |
136 | (from "darchive@.*\\.distorted\\.org\\.uk" "admin.misc") | |
51fb1b09 | 137 | (from "support@aa\\.net\\.uk" "admin.aaisp") |
d268047a | 138 | (from "bugs@distorted\\.org\\.uk" "admin.bugs") |
a9c07f72 | 139 | (from "darchive@distorted\\.org\\.uk" "admin.darchive") |
a27bd871 | 140 | |
a9c07f72 | 141 | ;; Colo and network provider. |
a27bd871 | 142 | (from "\\(accounts\\|support\\)@jump\\.net\\.uk" "keep.colo") |
a9c07f72 | 143 | (from "\\(accounts\\|support\\)@aa\\.net\\.uk" "keep.aaisp") |
a27bd871 MW |
144 | |
145 | ;; Mailing lists, not split out earlier. | |
5252f79a | 146 | (to "python-list@python\\.org" "lists.python") |
a9c07f72 MW |
147 | (to ,(concat "\\(jump-\\(announce\\|discuss\\)\\)@" |
148 | "\\(lists\\.\\|\\)" "jump\\.net\\.uk") | |
149 | "lists.\\1") | |
272f4216 MW |
150 | (to "cambridgecryptowhiskyclub@gmail\\.com" |
151 | "lists.cambridge-crypto-whisky") | |
a9c07f72 MW |
152 | (from ,(concat "@" "\\(" "liberty-human-rights" |
153 | "\\|" "libertyhumanrights" | |
154 | "\\|" "libertymail" | |
155 | "\\)" "\\.org\\.uk" "\\>") | |
156 | "lists.liberty" t) | |
10e55928 | 157 | (from "@openrightsgroup\\.org\\>" "lists.org" t) |
a9c07f72 MW |
158 | (from "@warwick\\.ac\\.uk\\>" "lists.warwick-uni" t) |
159 | (to "chiark-\\(motd\\|announce\\)@chiark\\.greenend\\.org\\.uk" | |
160 | "lists.chiark-announce") | |
161 | (any "clive-cambridge-gamers@nsict\\.org" "lists.nsict-games") | |
a27bd871 MW |
162 | |
163 | ;; Per-sender addresses. | |
a93d1938 MW |
164 | (to "\\<mdw-nospam-justgviing@" "crap.justgiving" t) |
165 | (to "\\<mdw-nospam-\\([^@]+\\)@" "crap.\\1" t) | |
166 | (to "\\<mdw-nopspam-\\([^@]+\\)@" "crap.\\1" t) | |
a27bd871 | 167 | |
093f5ffa MW |
168 | (to "\\(markw\\|mdw\\|mw\\)@odin\\.gg" "mail.misc") |
169 | ,@(mdw-odin-splits) | |
170 | (to "\\([a-z0-9]+\\)@odin\\.gg" "crap.odin-misc") | |
171 | ||
a27bd871 | 172 | ;; Regular nags. |
5252f79a MW |
173 | (from "\\(sealbot\\|cardbot\\)@ncipher\\.com" "nag.cardbot") |
174 | (from "\\<mailman-owner@" "nag.mailman" t) | |
a27bd871 | 175 | |
48c5ccb3 | 176 | ;; Uninteresting mail. |
10e55928 | 177 | (from "expiry@letsencrypt\\.org" "admin.letsencrypt") |
48c5ccb3 | 178 | |
a27bd871 | 179 | ;; Other splits I've not given a per-sender address. |
10e55928 MW |
180 | (from "@\\(.*\\.\\)?lovefilm\\.com\\>" "crap.lovefilm" t) |
181 | (from "@\\(\\|.*\\.\\)amazon\\." "crap.amazon" t) | |
182 | (from "@cineworldmail\\.com\\>" "crap.cineworld" t) | |
183 | (from "@picturehouses\\.co\\.uk\\>" "crap.picturehouse" t) | |
184 | (from "@nationwide" "crap.nationwide" t) | |
185 | (from "nationwide@securesuiteemail\\.com\\>" "crap.nationwide" t) | |
186 | (from "@news\\.spotifymail\\.com\\>" "crap.spotify" t) | |
187 | (from "@action\\.openrightsgroup\\.org\\>" "crap.org" t) | |
188 | (from "unlimited@cineworld\\.com\\>" "crap.cineworld" t) | |
189 | (from "@tshirthell\\.com\\>" "crap.tshirt-hell" t) | |
a93d1938 | 190 | (from "campaigns@jolla\\.com\\>" "crap.jolla" t) |
a9c07f72 MW |
191 | (from "@thomann\\.de\\>" "crap.thomann" t) |
192 | (from "@wikimedia\\.org\\>" "crap.wikimedia" t) | |
193 | (from "@gandi\\.net\\>" "crap.gandi" t) | |
194 | (from "@mythic-beasts\\.com\\>" "crap.mythic-beasts" t) | |
a27bd871 MW |
195 | |
196 | ;; Default. | |
90ad62cd | 197 | "mail.misc")) |
5252f79a | 198 | |
c77d8eb0 MW |
199 | ;;;-------------------------------------------------------------------------- |
200 | ;;; Where we get mail from. | |
201 | ||
202 | ;; Read mail on the IMAP server. | |
203 | (setq gnus-secondary-select-methods | |
90ad62cd | 204 | `((nnimap "distorted" |
c77d8eb0 MW |
205 | (nnimap-address "mail.distorted.org.uk") |
206 | (nnimap-stream starttls) | |
90ad62cd MW |
207 | (nnimap-inbox ("INBOX" "to.split")) |
208 | (nnimap-split-methods nnimap-split-fancy) | |
209 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 MW |
210 | (nnimap-unsplittable-articles (%Deleted))) |
211 | (nnimap "markw-distorted" | |
212 | (nnimap-address "mail.distorted.org.uk") | |
213 | (nnimap-stream starttls) | |
90ad62cd MW |
214 | (nnimap-inbox ("INBOX" "to.split")) |
215 | (nnimap-split-methods nnimap-split-fancy) | |
216 | (nnimap-split-fancy ,nnmail-split-fancy) | |
c77d8eb0 MW |
217 | (nnimap-unsplittable-articles (%Deleted))) |
218 | (nnimap "mwooding-chiark" | |
219 | (nnimap-address "imap.dovecot.chiark.greenend.org.uk") | |
220 | (nnimap-stream starttls) | |
c77d8eb0 MW |
221 | (nnimap-inbox "INBOX") |
222 | (nnimap-unsplittable-articles (%Deleted))) | |
223 | (nnimap "google" | |
224 | (nnimap-address "imap.gmail.com") | |
225 | (nnimap-stream tls) | |
226 | (nnimap-inbox "INBOX") | |
227 | (nnimap-unsplittable-articles (%Deleted))))) | |
228 | ||
229 | ;; Send sent mail back to me. | |
230 | (setq gnus-message-archive-method "mail" | |
231 | gnus-gcc-mark-as-read t | |
232 | gnus-message-archive-group "nnimap+distorted:mail.sent") | |
233 | ||
5252f79a | 234 | ;;;----- That's all, folks -------------------------------------------------- |