Simple server-side e-mail aggregation setup
Clone
HTTPS:
git clone https://vervis.peers.community/repos/xobxE
SSH:
git clone USERNAME@vervis.peers.community:xobxE
Branches
Tags
Files
🗎 | AUTHORS |
🗎 | COPYING |
🗎 | INSTALL |
🗎 | README.md |
🗎 | TODO |
🗎 | doar.cron |
🗎 | doar.sh |
🗎 | install.sh |
🗎 | mpoprc |
🗎 | uninstall.sh |
README.md
doar - simple mail aggregation setup based on ‘mpop’ and ‘msmtp’
Purpose
‘doar’ is a simple cron job and a per-user config file, meant for use by mail servers. It allows users to specify external e-mail accounts from which their mail will automatically be collected by the server and put into their local inbox. The advantages of doing so are:
- Easier transition to a new e-mail provider
- One account, one address, one password to remember
- Access all mail from all providers remotely and uniformly using a single provider
But these are not specific to ‘doar’. What ‘doar’ aims to do is provide a simple, configurable and lightweight mechanism for mail aggregation, which can be used with any mail server and without dependency on specific UI. Possible UIs for mail users to configure ‘doar’:
- SSH (perhaps limited, if general SSH access isn’t given otherwise)
- e-mail (send specially formatted e-mail to a special system account)
- web interface with CGI
- script or GUI on the user’s machine, which internally may use mail or SSH or some messaging over HTTP/XMPP/etc.
Folder Structure
Each user can have a folder ‘~/.config/doar’. That folder contains the following files:
- ‘account_defs’: definitions of external POP accounts in mpop format
- ‘account_list’: one-per-line list of accounts to actually pull from
The system contains server-wide config as follows:
- cron job
- script that runs on cron job
- beginning of mpoprc which will be prepended to each ‘account_defs’
It’s possible to configure msmtp using a config file just like mpop, but I currently prefer to use command-line options since for this use case the configuration is trivial and requires parameters passed from mpop.
Suggested locations for the files:
- /etc/cron.d/doar
- /usr/bin/doar or /usr/local/bin/doar
- /etc/doar/mpoprc
Installation
See the file ‘INSTALL’.
Account Configuration
Each user on your server can participate in e-mail aggregation by creating the files ‘account_defs’ and ‘account_list’, mentioned above. If it’s not a personal home server, and you have users who are not you, make sure they understand how to fill these files. In order to NOT participate, a user simply needs to remove or rename at least one of these files.
‘account_defs’ should preferrably have only user read-write permissions, to minimize the risk something unwanted reads the passwords and account details. mpop can also be configured to get the password by running a command, e.g. decrypt a gpg-signed file which contains the password or maybe fetch it from a system keyring.
It should be written in mpop configuration syntax, and only define accounts. In other words, it’s contains just account definition blocks and should more or less like this:
account jdoe_riseup
host mail.riseup.net
user jdoe
password 7b87B78BG87g68G
account jdoe2_riseup : jdoe_riseup
user jdoe2
password f%dc56cdf%^4v77v57l
tls_starttls off
account fr33mail
host pop.fr33mail.libre
user johndoe
password 4dc%f7H9nny&hbTCE4D45
account i2p
host 127.0.0.1
port 7890
user jekyll
password cDe$5^7*9knBgT
tls off
Comments are allowed just like in any mpop configuration file.
‘account_list’ is a vertical list of account names, i.e. one per line. Lines starting with ‘#’ are ignored and blank lines are allowed, so there’s place for comments. Example:
### list of external e-mail accounts to pull from into this server
jdoe_riseup
#jdoe2_riseup
fr33mail
i2p
# note for myself:
# I stopped using jdoe2 account but keeping it just in case