Commit graph

27 commits

Author SHA1 Message Date
Marty Oehme bd71cfc168
mail: Use new neomutt styling, extend html view 2022-03-19 11:36:28 +01:00
Marty Oehme ea95ca7dfa
mail: Update mail-check to work with pass-coffin
Updated code to be able to run a password command chosen individually,
as well as a post-password command.

Used in this instance to `pass open` a password store in a coffin/tomb
before actually trying to read passwords out of it.
2022-01-28 18:32:58 +01:00
Marty Oehme a99982028e
mail: Update to new neomutt structure
Updated notmuch to only be available for full-text search. Removed
complete afew configuration.

Added msmtp as mail sending agent.

Added structured neomutt configuration with custom bindings, built for
my personal gmail account, without any plaintext passwords revealed,
etc.

This is a reasonably well working mail setup,
which should provide a stable starting point for further refinements.

Additionally, added some functionality to `mail-check` script:
Allowed user to choose sync target for each run, by
passing in mbsync target (group/channel/..) as the argument.
Also, allows setting password file to use for script through env var,
and made imapfilter location less hard-coded to my system.
2021-11-23 16:09:32 +01:00
Marty Oehme f4c3944519
mail: Switch aerc for neomutt, simplify maildir
Made mail dir synchronization simpler - only a couple of important
directories will ever get synchronized to the local file system, but
still containing basically all important incoming mails.

Removed aerc and switched it for neomutt. aerc is very nice and needs
little to no configuration but neomutt is, as of this moment, just more
stable and mature. It opens quickly, never crashes, has a nice indexing
and quick e-mail handling behavior and is incredibly customizable.
Basically, once you put in some configuration effort, it is everything
aerc isn't --- and that is good, both have their reasons for existing.
It's just that mutt currently works better for me and will thus be the
e-mail reader of choice from now on.
2021-10-10 23:04:24 +02:00
Marty Oehme 78b47a35b2
mail: Fix checkmail script password bugging
Fixed script to only ask for password once before understanding that the
user does not want to provide it.

Since gpg seems to not differentiate between a *wrongly* entered
password and one entered not at all, we have to assume the user canceled
the password prompt and not bug him again until the next time the script
is invoked.
It will, however, at least notify the user that the process is aborted
in a quick notification message, so that if it was done on accident the
user will still know what's up.
2021-08-19 00:21:16 +02:00
Marty Oehme f4400da743
repo: Update linting for 4-spaced shell scripts 2021-04-04 20:52:52 +02:00
Marty Oehme 41bfe2df69
mail,mpv,qutebrowser,vifm: Fix small issues
Added videos directory to vifm quick marks (`v`).

Fixed (hopefully) qutebrowser statusbar hiding and showing.

Improved mail checking script password file handling by switching the
hard-coded path to one still somewhat hard-coded, but encapsulated in a
variable to make changing it later on easier. The script is a bit
slap-dash anyway, so when refactored should be refactored overall.

Added `gallery-dl` handling by mpv, whenever a link starting with
`gdl://` is passed in.
2021-03-16 14:37:38 +01:00
Marty Oehme e86298e39a
aerc: Simplify label mappings
Every modification starts with `m` (for mark, akin to vim), and pushes
the messages into the respective state: `a`rchive, `i`nbox, `m`ark
(flag), `d`ump.

Only deletion (`dd`) behaves slightly differently, in that it simulates
a state not a label (even though labels are used in the background).

Fixed moving through different parts of an e-mail being reversed from
what one would expect.
2020-12-03 11:53:27 +01:00
Marty Oehme bc534e2026
mail: Re-enable tagging by folder for notmuch
Should help aerc decide what to show in inbox and what to leave out.
2020-11-13 08:54:24 +01:00
Marty Oehme 0e34af1992
lua: Fix formatting with lua-format 2020-11-06 15:03:33 +01:00
Marty Oehme 1311c30e84
mail: Fix mail filtering
Fixed correct filtering of inbox stuff in afew (moving archived mails
out of inbox, moving trash into GMail Trash).
2020-10-01 09:04:24 +02:00
Marty Oehme 3c84d6ae1a
mail: Improve inbox display in aerc and notmuch
Added filtering by dump tag *or* folder to afew so that incoming mail
should automatically be filed exclusively in inbox or the dump for
notmuch.

Additionally changed the exception for inbox display from list to dump
tags in aerc, so that -- should there be a legitimate mailing list mail,
such as gitlab's pipeline reports -- they are still visible in inbox.
2020-09-25 11:25:18 +02:00
Marty Oehme 3fa7f8a6db
mail: HACK mailcheck update
Update `mail-check` script to notify the user both of newly arrived
mail, and in case he has to enter his password to sync the mail.

HACK the paths and ways of finding out if passwords can be decrypted are
static and only applicable to my set up. This needs to be completely
revised and newly approached.
2020-09-24 16:24:34 +02:00
Marty Oehme c5cd2b6a8d
mail: Enable direct pgp decryption
When called over systemd, pass will not display a pin-entry field to
decrypt the necessary passwords for email synching.

This prepares automatic background synching.
2020-09-24 14:22:03 +02:00
Marty Oehme 407ad0473f
mail: Fix mail-check hooks
Fixed running the hooks for `mail-check`. Command (or variable?)
substition prevented the hooks from running completely beforehand, so I
moved them to a separate function with the option remaining to call a
custom script for them through environment variables.

Ideally the env vars (`MBSYNC_PRE` and `MBSYNC_POST`) should only point
to a single script each, as more involved commands will presumably fail
to execute correctly when whitespace substition is involved.

See more explanation here:
https://unix.stackexchange.com/a/444949
2020-09-24 10:00:47 +02:00
Marty Oehme b176b61b52
mail: Move rollup data to XDG data dir
Moved the file containing sender addresses to filter to the
XDG_DATA_HOME directory (usually `~/.local/share/imapfilter/`) where it
will look for a `rollup.txt` file.

This is to separate the configuration values (the filters themselves)
somewhat from the data they act on (values to filter and searches to
accomplish).
2020-09-23 17:55:08 +02:00
Marty Oehme 2b289a953b
mail: Add IDLE mode watching
Added option to imapfilter to continuously run in the background and
watch for new incoming mail through the Imap IDLE mode.

By default it will run as one-shot and just sort mail according to
currently active filters. But if enabling the `CONTINUOUS` mode in
config file, it will instead keep running and continuously check for
arriving mail to filter.

This could, in the future, be useful to run on a separate server which
watches remote imap folders and pulls them down to its own storage.

For local usage, a systemd service and timer unit are probably more
suitable than the daemonization of imapfilter.
2020-09-23 17:55:07 +02:00
Marty Oehme 85c68fc676
mail: Add local folder and tag alignment
afew will locally add notmuch tags to mails, as well as move them to
specific folders according to the notmuch tags they already contain.

This sets mails residing in the `Dump` folder to be tagged
correspondingly with `dump`.
(imapfilter automatically puts all filtered
adverts and mailing lists into the dump folder beforehand.)

On the other hand, it makes sure that email tagged with `dump` also
resides in the `Dump` folder (if tagged manually with notmuch), and same
thing for `Inbox`.
2020-09-23 17:55:07 +02:00
Marty Oehme bf80c9ecf3
mail: Read mails to roll up from external file
Changed rollup filter to read the files to be rolled up from 'rollup.txt'
file in the imapfilter configuration directory. (by default in XDG
basedir-compliant directory such as '~/.config/imapfilter/rollup.txt')

The file consists of sender addresses with a single address on each
line.
2020-09-23 17:55:07 +02:00
Marty Oehme 698e8a63ee
mail: Refactor imapfilter configuration
Make imapfilter configuraiton more flexible to prepare for different
filters being added.

The program will expect its configuration and filter files to be located
in XDG directory structure, within the sub-folder 'filters'.
E.g.: `/home/user/.config/imapfilter/filters`

A global `configDir` variable is available for any filters, which
describes the path to the current configuration directory.
The path to the filter directory can also be accessed through
`getFilterDir()`.

The configuration runs `accounts.lua` and expects it to return a table
with the individual imap boxes as top level entries, so that filters can
then loop through each account as needed.

Lastly, the config will automatically apply all filters found in the
filters sub-folder. A filter is a '.lua' file within the directory.
Other files can exist in the dir and will not be touched.
2020-09-23 17:55:07 +02:00
Marty Oehme 0d00953f30
mail: Add afew automatic tagging
Added hook for afew tagging for local mail.

Mail will now arrive tagged only as 'new' by notmuch.
afew will then tag the mail accordingly as inbox unread when it is
personal mail.

It will additionally filter out anything marked as spam, or e-mail
containing a List-Id header, which will be tagged as 'list' and not
arrive in the inbox. This filters out anything arriving from a mailing
list from the inbox.

Removed the archive tag -- anything not in the inbox, and not marked as
list is instead used as an automatic archive.

Mail sent by myself will be automatically tagged as 'sent' and also not
show up in the mailbox.
2020-09-23 17:55:06 +02:00
Marty Oehme be688572f5
mail: Add contacts lookup script
Added `mail-searchcontacts` script, which uses notmuch to search for all
contacts of the mail database.

Can be invoked without any arguments to list *all* contacts of the
dataase in descending order of message count.
Otherwise, it will filter known contacts, first by prioritizing the
'from:' field, and otherwise by searching through the whole database for
the keywords passed in.

It will also re-format the results so that the list consists of
tab-delineated 'mail name' rows. If there is no name, the row will only
contain the bare e-mail address. This format is best accepted by aerc,
for which the script is written.

aerc uses the contacts script for its address completion in editing
e-mail headers.

Renamed `checkmail` to `mail-check` to fit the naming scheme of
`mail-[action]` for mail scripts, to better be able to group them in the
shell.
2020-09-23 17:55:06 +02:00
Marty Oehme 5a256186c2
mail: Add basic filtering system
imapfilter now looks for account information in an accounts.lua file in
its configuration directory -- the file should return account
information as a table with each account being a top-level entry in the
table.

A sample spam-moving script has been supplied:
For now, it will take a list of sender addresses and put everything in
the list from the inbox into the dump directory.

An example list of senders has been supplied for testing purposes, but
this should eventually be read from a file containing an extensible list
of senders (and perhaps even different properties such as subject, etc.)

The imapfilter xdg alias has been fixed.

Coherence between the imap folder structure and notmuch tagging system
still has to be achieved -- either by aerc using the folder structure as
a query map, or notmuch tags automatically being applied for specific
imap filtering options.
2020-09-23 17:55:06 +02:00
Marty Oehme 1564aa8176
mail: Add fzfmail script
`fzfmail` allows searching, previewing, displaying and tagging mail
through the fzf interface.
2020-09-23 17:55:06 +02:00
Marty Oehme 3bbb7d0360
mail: Add checkmail routine
Added script to call for checking mail. Will run individual pre- and
post-hooks. (By default, imapfilter and notmuch update.)

Simple options can be changed through environment variables:

Hooks can be set to different scripts with MBSYNC_PRE and
MBSYNC_POST, respectively.

Will also run mbsync repeatedly, until it exits without error. By
default it will try running it 3 times before giving up, this can be set
with MBSYNC_MAX_TRIES.

No functional imapfilters have been added yet.

mbsync and imapfilter both adhere to the XDG base directory layout
(somewhat), checking for their option files in .config/{isync,imapfilter}
respectively.

Everything still pending changes, the mail eco-system is hard to
wrap one's head around.
2020-09-23 17:55:05 +02:00
Marty Oehme 674b1cfeac
mail: Add aerc notmuch configuration 2020-09-23 17:55:05 +02:00
Marty Oehme 7871442bcd
mail: Initial commit 2020-09-23 17:55:05 +02:00