Discussion:
How do you sync your mail constantly?
Vika Shleina
2018-11-01 08:49:47 UTC
Permalink
Hello list! I encountered a bit of an UX issue, I think. How do you
synchronize mail constantly and index it with notmuch?

My current setup is mbsync in pre-hook, then post hook: alot + alot
move-mode + mbsync + notifymuch. All of this is run manually. The thing
is - I need to sync all folders since I move mails (so my INBOX would
not get clogged by mailing list messages when I'm viewing it on mobile).
Probably INBOX can be put on IMAP PUSH, but other folders still need to
be synced manually.

The possible solutions are:

1. Put everything into some sort of cron job (systemd timer?). This
looks the easiest, but would sync mail only <X> minutes.

2. Get rid of first mbsync, make it only poll INBOX, then index it every
time a new message comes. Feels a bit impractical to run `notmuch new`
for every message, since I'm not that proficient in mbsync settings.
Also I'm using NixOS and home-manager to keep most of the setup working,
so maybe there would be a little more or a lot less config tweaking.

This setup also has a problem of overloading my mail server, which can
possibly crash it since I keep it on my RPi. Folder moves could probably
be run only every <X> minutes, but that would require somehow rewriting
my hooks.

3. Get rid of folder-moving. Would need to get rid of mobile mail access
too... probably.

4. Transfer the setup to mail server. Would take more time, but I would
be able to move and index messages even when my laptop is unavailable.
Also would require setting up Nix (since my server runs on Gentoo).

And to maybe think of alternative solution, I ask you - what do you use
to seamlessly sync your mail?

P. S. Is signature traditionally inserted with -- or with ---? just
wondering...
William Casarin
2018-11-03 07:23:27 UTC
Permalink
Post by Vika Shleina
And to maybe think of alternative solution, I ask you - what do you use
to seamlessly sync your mail?
I use a script[1] that connects to my imap server. New mail comes into
my sieve-filtered inbox[2] which then triggers the imap-notify[1] script
on my local machine. This script runs muchsync, which in turn runs
notmuch new on the remote machine, and then syncs tags between the local
machine and the server.

Once muchsync finishes I trigger a notification[4] with notify-send,
which pops up a message on twmnd.

To make this rube goldberg device work I have a bunch of systemd
services[5] defined in NixOS that manages everything. It's pretty hacky
and can get stuck, so I have a python script that restarts imap-notifier
when I wake from sleep when I'm on my laptop.

I should probably get around to turning this into a single program that
works well, but here we are.

My setup with muchsync assumes you run your own mailserver. If you're
using something like gmail you can scrap the muchsync step and just use
an imap-notifier-like script to run mbsync and the notmuch-new.

Cheers,
Will


[1] https://github.com/jb55/imap-notify
[2] I'm not happy with the setup, I would prefer to not have to use
sieve and use tagging directly. but for now it allows me to read my
mail on my phone.
[3] http://www.muchsync.org/
[4] Which I have off most of the time, notifications are terrible. I
toggle them on/off with cmdtree: https://git.sr.ht/~jb55/cmdtree
[5] https://github.com/jb55/nix-files/blob/monad/misc/imap-notifier/default.nix
Tomas Nordin
2018-11-05 19:35:17 UTC
Permalink
Hello Vika
Post by Vika Shleina
Hello list! I encountered a bit of an UX issue, I think. How do you
synchronize mail constantly and index it with notmuch?
I use offlineimap for syncing. Works perfect for me. I am syncing two
mail accounts this way, using some mail service providers. Offlineimap
works by keep running and I have it configured to sync every 4 minutes.
Then I have a hook (postsynchook) in the offlineimap config that calls a
script where I index and tag stuff with notmuch. It shouldn't be
difficult to move messages between folders during that script, I guess
before indexing with notmuch.
Post by Vika Shleina
My current setup is mbsync in pre-hook, then post hook: alot + alot
move-mode + mbsync + notifymuch. All of this is run manually. The thing
is - I need to sync all folders since I move mails (so my INBOX would
not get clogged by mailing list messages when I'm viewing it on mobile).
I do some refiling of mailing-list items, but semi-manually. I have
key-bindings to mark messages with a tag 'rfile' and then in the 'hello'
buffer I have a another key-binding to trigger the actual move between
folders. I put those list-messages in a folder 'archive' which is not
synced and hence gets deleted from server. (Not sure if this was also
your concern but anyway).

Happy Notmuching
--
Tomas

Loading...