Mail with Gnus
This is my setup to use Gnus together with getmail, procmail and msmtp to speed up things, using the maildir backend (fast and reliable)
Fist: setup getmail using a wrapper to support multiple accounts:
#!/bin/sh
set -e
cd $HOME/.getmail
rcfiles=""
for file in *rc ; do
rcfiles="$rcfiles --rcfile $file"
done
exec /usr/bin/getmail $rcfiles $@
Call it run-getmail, put it in your $PATH, and execute in it your crontab.
Create the -rc files in ~/.getmail, one for account.
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = myuser
port = 995
password = mypassword
[destination]
type = MDA_external
path = /usr/bin/procmail
arguments = ("-f", "%(sender)")
Let's set up ~/.procmailrc
PATH=/bin:/usr/bin:/usr/local/bin
DEFAULT=$HOME/Maildir/misc/
MAILDIR=$HOME/Maildir
LOGFILE=$HOME/.procmaillog
# Recipes below this comment:
:0:
* ^(To|CC):.*anarchysf@lists.mutualaid.org
$MAILDIR/anarchysf/
:0:
* ^Subject: ntg-context Digest
$MAILDIR/ConTeXtDigest/
:0:
${DEFAULT}
Note the trailing slash. The mails will land in ~/Maildir in the maildir format.
Set up the ~.msmtprc
account default
host smtp.server1.net
port 25
from marco@server1.net
tls on
tls_starttls on
tls_certcheck off
auth on
user username@server1.net
password blablabla
logfile ~/.msmtp.log
account gmail
host smtp.gmail.com
port 587
from pincopallino@gmail.com
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth on
user pincopallino@gmail.com
password blablablabla
logfile ~/.msmtp.log
Another little effort. Create the ~/.gnus.el
(setq user-mail-address "marco@server1.com")
(setq user-full-name "Marco")
(setq gnus-select-method '(nntp "news.gmane.org"))
(setq gnus-secondary-select-methods
'((nnmaildir "mail" (directory "~/Maildir"))))
;; arbitrary name after "nnmaildir+"
(setq gnus-message-archive-group "nnmaildir+marco:outbox")
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/usr/bin/msmtp")
(setq message-sendmail-envelope-from 'header)
;; we want to browse freely from gwene (RSS)
(setq gnus-safe-html-newsgroups "\\`nntp[+:]news\\.gwene\\.org[+:]")
;; minimal but useful setup to manage different identities
(setq gnus-posting-styles '((".*"
(signature-file "~/.signature")
(name "Marco"))
("nnmaildir"
(From (with-current-buffer gnus-article-buffer
(message-fetch-field "to"))))))
You're ready. Start emacs and type M-x gnus
Optional reading: 400 pages of manual.