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