[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nnimap workflow examples?
From: |
Jose A. Ortega Ruiz |
Subject: |
Re: nnimap workflow examples? |
Date: |
Sun, 26 Apr 2020 23:47:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Garjola,
On Fri, Apr 24 2020, Garjola Dindi wrote:
[...]
> I am looking for examples of configurations or workflows that I could
> use.
Here goes what i do, since i do thinks a tad differently that what i've
seen explained in the available tutorials. As you're about to see, it's
kind of complicated, and i don't expect many people to use it in the
same way, but there are some bits and pieces that i discovered over the
years and that might be useful by themselves.
- I keep my local email using dovecot smptp server. I configure it to
use a maildir directory in my home (~/var/mail), and all local mails
eventually end there, although Gnus access them exclusively via
nnimap (to localhost).
- As an aside, the fact that ~/var/mail is a regular maildir allows me
to have notifications of new mails and the like independently of
dovecot or Gnus (i use a xmobar monitor, and sometimes a little emacs
lib i wrote that in turn uses inotify).
- To fetch mail from remote imap servers (in my case a gmail account
for work and protonmail via its bridge), i use fetchmail
- I tell fetchmail to deliver the fetched mails using dovecot's mda.
This is an example using cli flags, but the same can be done in
fetchmailrc
mda="/usr/lib/dovecot/dovecot-lda -a"
function fetch_work () {
fetchmail --ssl --sslproto auto --folder $1 $2 $3 \
--mda "$mda jao+work/${1,,}" \
--user jao@bigml.com imap.gmail.com
}
fetch_work INBOX --keep
fetch_work support --nokeep --fetchall
Here, i'm fetching mail from a gmail INBOX and telling fetchmail to
deliver it to dovecot with envelope addresses
jao+work/inbox@localhost, and fetching mail from a gmail "folder"
called support and sending it to jao+work/support@locahost. "jao"
is my local username.
Also, in the first case i'm keeping emails in the remote server and
in the second deleting them when i download them.
- In dovecot, i have a sieve filter that sends mail directed to
jao+FOO to the local inbox FOO. so those mails above go to local
imap inboxes work/inbox and work/support. That's what Gnus sees
when it connects to the local imap server: a work/inbox and a
work/support.
- This can be extended to as many remote imap folders and servers as
you want (i have two servers and a handful of folders in each).
- I also have local sieve filters to put mail fetched from the remote
server in different local imap boxes. I prefer the filtering being
doing by dovecot because that way may email notifiers (which look at
the inbox maildirs) don't depend on a gnus fetch: i get a
notification as soon as dovecot puts the mail there (usually
instructed by fetchmail, asynchronosuly, but also local mail
deliveries go there).
- To search mail locally, one can use the regular nnimap search in
Gnus against the local dovecot server. I also use in paralell
ivy-notmuch: i tell notmuch to (re)index ~/var/mail after each
fetchmail round (that's in a cron job), and the perform searches
typically with ivy-notmuch)... i've got a little bit of elisp that
goes then from a notmuch result to the corresponding mail in Gnus.
- I use postfix to deliver email using different remote SMTP servers
(multiplexing on the mail's From: address), so emacs sends all mails
to just to the local MTA (postfix), and it asynchronously takes care
of dispatching the mail (that way, sending an email is always almost
instantaneous).
It's simpler than it looks :)
HTH,
jao
--
Once you hear the details of victory, it is hard to distinguish it
from a defeat. -Jean-Paul Sartre, writer and philosopher (1905-1980)