@@ -1,3 +1,2 @@ | |||
custom: ["https://lukesmith.xyz/donate.html"] | |||
github: lukesmithxyz | |||
custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"] | |||
patreon: lukesmith |
@@ -4,23 +4,24 @@ OS = $(shell uname -s) | |||
ifndef PREFIX | |||
PREFIX = /usr/local | |||
endif | |||
MANPREFIX = $(PREFIX)/share/man | |||
ifndef MANPREFIX | |||
MANPREFIX = $(PREFIX)/share/man | |||
endif | |||
install: | |||
mkdir -p $(DESTDIR)$(PREFIX)/bin | |||
for script in bin/*; do \ | |||
cp -f $$script $(DESTDIR)$(PREFIX)/bin/; \ | |||
chmod 755 $(DESTDIR)$(PREFIX)/$$script; \ | |||
done | |||
mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard | |||
cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/ | |||
cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard | |||
chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile | |||
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard | |||
chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard | |||
for shared in share/*; do \ | |||
cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ | |||
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \ | |||
done | |||
cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/switch.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard | |||
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc | |||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1 | |||
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||
cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||
if [ "$(PREFIX)" ]; then \ | |||
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ | |||
rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ | |||
@@ -28,13 +29,13 @@ install: | |||
rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \ | |||
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ | |||
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \ | |||
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \ | |||
rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \ | |||
fi | |||
uninstall: | |||
for script in bin/*; do \ | |||
rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \ | |||
done | |||
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard | |||
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 | |||
rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile | |||
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard $(DESTDIR)$(PREFIX)/lib/mutt-wizard | |||
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 | |||
.PHONY: install uninstall |
@@ -1,116 +1,220 @@ | |||
# mutt-wizard | |||
https://muttwizard.com/ | |||
Get this great stuff without effort: | |||
- A full-featured and autoconfigured email client on the terminal with neomutt | |||
- Mail stored offline so you can view and write email while you're away from internet and keep backups | |||
- Mail stored offline enabling the ability to: | |||
* view and write emails while you're away from | |||
the internet | |||
* make backups | |||
- Provides a `mailsync` script that can be scheduled to run as often as you | |||
like, which downloads/syncs mail and notifies you when new mail has arrived. | |||
Specifically, this wizard: | |||
- Determines your email server's IMAP and SMTP servers and ports | |||
- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address | |||
- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key | |||
- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your | |||
email address | |||
- Encrypts and locally stores your password for easy remote access, accessible | |||
only by your GPG key | |||
- Handles as many as nine separate email accounts automatically | |||
- Auto-creates bindings to switch between accounts or between mailboxes | |||
- Can automatically set mail updates as often as you want to sync your mail and update you when new mail arrives | |||
- Provides sensible defaults and an attractive appearance for the neomutt email client | |||
- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. | |||
- Provides sensible defaults and an attractive appearance for the neomutt email | |||
client | |||
- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will | |||
prompt you for them and will put them in all the right places. | |||
## Install and Use | |||
## Install | |||
``` | |||
#### Dependencies | |||
- `neomutt` - the email client. (If you are using Gentoo GNU/Linux, you will need the `sasl` use flag to be enabled) | |||
- `curl` - tests connections (required at install). | |||
- `isync` - downloads and syncs the mail (required if storing IMAP mail locally). | |||
- `msmtp` - sends the email. | |||
- `pass` - safely encrypts passwords (required at install). | |||
**Note**: There's a chance of errors if you use a slow-release distro like | |||
Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most | |||
recent version manually or manually remove the offending lines in the config in | |||
`/usr/share/mutt-wizard/mutt-wizard.muttrc`. | |||
```bash | |||
git clone https://github.com/LukeSmithxyz/mutt-wizard | |||
cd mutt-wizard | |||
sudo make install | |||
``` | |||
User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). | |||
A user of Arch-based distros can also install the current mutt-wizard release from the AUR as | |||
[mutt-wizard](https://aur.archlinux.org/packages/mutt-wizard/), or the Github master branch, [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). | |||
The mutt-wizard is run with the command `mw`. It also installs the `mailsync` command. Once everything is setup, you'll use `neomutt` to access your mail. | |||
### Optional Dependencies | |||
- `mw add` -- add a new email account | |||
- `mw ls` -- list existing accounts | |||
- `mw pass` -- revise an account's password | |||
- `mw delete` -- delete an added account | |||
- `mw purge` -- delete all accounts and settings | |||
- `mw cron` -- toggle/configure a cronjob to sync mail | |||
- `pam-gnupg` - Automatically logs you into your GPG key on login so you will | |||
never need to input your password once logged on to your system. Check the | |||
repo and directions out [here](https://github.com/cruegge/pam-gnupg). | |||
- `lynx` - view HTML email in neomutt. | |||
- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell | |||
it that your mail is in `~/.local/share/mail/` (although `mw` will do this | |||
automatically if you haven't set notmuch up before). You can run it in mutt | |||
with <kbd>ctrl-f</kbd>. Run `notmuch new` to process new mail. | |||
- `abook` - a terminal-based address book. Pressing tab while typing an address | |||
to send mail to will suggest contacts that are in your abook. | |||
- `urlview` - outputs urls in mail to browser. | |||
- `cronie` - (or any other major cronjob manager) to set up automatic mail | |||
syncing. | |||
- `mpop` - If you want to use POP protocol instead of IMAP. | |||
## Dependencies | |||
- `neomutt` - the email client. | |||
- `isync` - downloads and syncs the mail. (required at install) | |||
- `msmtp` - sends the email. | |||
- `pass` - safely encrypts passwords (required at install) | |||
## Usage | |||
There's a chance of errors if you use a slow-release distro like Ubuntu, Debian or Mint. If you get errors in `neomutt`, install the most recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. | |||
The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use | |||
`neomutt` to access your mail. | |||
### Optional | |||
- `mw -a you@email.com` -- add a new email account | |||
- `mw -l` -- list existing accounts | |||
- `mw -y your@email.com` -- sync an email account | |||
- `mw -Y` -- sync all configured email accounts | |||
- `mw -d` -- choose an account to delete | |||
- `mw -D your@email.com` -- delete account settings without confirmation | |||
- `mw -t 30` -- toggle automatic mailsync to every 30 minutes | |||
- `mw -T` -- toggle mailsync without specifying minutes (default is 10) | |||
- `mw -r` -- reorder account shortcut numbers | |||
- `pass edit mw-your@email.com` -- revise an account's password | |||
- `lynx` - view HTML email in neomutt. | |||
- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail, although the included `mailsync` script does this for you. | |||
- `libnotify`/`libnotify-bin` - allows notifications when syncing mail with `mailsync` | |||
- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. | |||
- A cron manager - if you want to enable the auto-sync feature. | |||
- `pam-gnupg` - this is a more general program that I use. It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). | |||
- `urlview` - outputs urls in mail to browser. | |||
### Options usable when adding an account | |||
#### Providing arguments | |||
- `-u` -- Give an account username if different from the email address. | |||
- `-n` -- A real name to be used by the account. Put in quotations if multiple | |||
words. | |||
- `-i` -- IMAP server address | |||
- `-I` -- IMAP server port (otherwise assumed to be 993) | |||
- `-s` -- SMTP server address | |||
- `-S` -- SMTP server port (otherwise assumed to be 465) | |||
- `-m` -- Maximum number of emails to be kept offline. No maximum is default | |||
functionality. | |||
- `-x` -- Account password. You will be prompted for it otherwise. | |||
#### General Settings | |||
- `-f` -- Assume mailbox names and force account configuration without | |||
connecting online at all. | |||
- `-o` -- Configure mutt for an account, but do not keep mail offline. | |||
- `-p` -- Use POP protocol instead of IMAP (requires `mpop` installed). | |||
## Neomutt user interface | |||
To give you an example of the interface, here's an idea: | |||
- `m` - send mail (uses your default `$EDITOR` to write) | |||
- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go down/up a page). | |||
- `l` - open mail, or attachment page or attachment | |||
- `h` - the opposite of `l` | |||
- `r`/`R` - reply/reply all to highlighted mail | |||
- `s` - save selected mail or selected attachment | |||
- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. | |||
- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox letters above, i.e. `MS` means "move to Spam". | |||
- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you add 9 accounts via mutt-wizard, they will each be assigned a number. | |||
- `a` to add address/person to abook and `Tab` while typing address to complete one from book. | |||
- `?` - see all keyboard shortcuts | |||
- `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. | |||
- `ctrl-b` - open a menu to select a url you want to open in you browser. | |||
- <kbd>m</kbd> - send mail (uses your default `$EDITOR` to write) | |||
- <kbd>j</kbd>/<kbd>k</kbd> and <kbd>d</kbd>/<kbd>u</kbd> - vim-like bindings to go down and up (or <kbd>d</kbd>/<kbd>u</kbd> to go | |||
down/up a page). | |||
- <kbd>l</kbd> - open mail, or attachment page or attachment | |||
- <kbd>h</kbd> - the opposite of <kbd>l</kbd> | |||
- <kbd>r</kbd>/<kbd>R</kbd> - reply/reply all to highlighted mail | |||
- <kbd>s</kbd> - save selected mail or selected attachment | |||
- <kbd>gs</kbd>,<kbd>gi</kbd>,<kbd>ga</kbd>,<kbd>gd</kbd>,<kbd>gS</kbd> - Press <kbd>g</kbd> followed by another letter to change | |||
mailbox: <kbd>s</kbd>ent, <kbd>i</kbd>nbox, <kbd>a</kbd>rchive, <kbd>d</kbd>rafts, <kbd>S</kbd>pam, etc. | |||
- <kbd>M</kbd> and <kbd>C</kbd> - For <kbd>M</kbd>ove and <kbd>C</kbd>opy: follow them with one of the mailbox | |||
letters above, i.e. <kbd>MS</kbd> means "move to Spam". | |||
- <kbd>i#</kbd> - Press <kbd>i</kbd> followed by a number 1-9 to go to a different account. If you | |||
add 9 accounts via mutt-wizard, they will each be assigned a number. | |||
- <kbd>a</kbd> to add address/person to abook and <kbd>Tab</kbd> while typing address to complete | |||
one from abook. | |||
- <kbd>?</kbd> - see all keyboard shortcuts | |||
- <kbd>ctrl-j</kbd>/<kbd>ctrl-k</kbd> - move up and down in sidebar, <kbd>ctrl-o</kbd> opens mailbox. | |||
- <kbd>ctrl-b</kbd> - open a menu to select a URL you want to open in your browser. | |||
- <kbd>p</kbd> - encrypt/sign your message (in compose view, before sending the email). | |||
## Additional functionality | |||
- `pam-gnupg` - Automatically logs you into your GPG key on login, so you will | |||
never need to input your password once logged on to your system. Check the | |||
repo and directions out [here](https://github.com/cruegge/pam-gnupg). | |||
- `lynx` - View HTML email in neomutt. | |||
- `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it | |||
that your mail is in `~/.local/share/mail/` (although `mw` will do this | |||
automatically if you haven't set notmuch up before). You can run it in mutt | |||
with <kbd>ctrl-f</kbd>. Run `notmuch new` to process new mail. | |||
- `abook` - A terminal-based address book. Pressing tab while typing an address | |||
to send mail to will suggest contacts that are in your abook. | |||
- `urlview` - Outputs URLs in an email to your browser. | |||
## New stuff and improvements since the original release | |||
- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. | |||
- `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. | |||
- `dialog` is no longer used (le bloat) and the interface is simply text commands. | |||
- More autogenerated shortcuts that allow quickly moving and copying mail between boxes. | |||
- More elegant attachment handling. Image/video/pdf attachments without relying on the neomutt instance. | |||
- `mw` is now scriptable with command-line options and can run successfully | |||
without any interaction, making it possible to deploy in a script. | |||
- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was | |||
error-prone, bloated, used obsolete Python 2 modules, and required separate | |||
steps to install the system. | |||
- `mw` is now an installed program instead of just a script needed to be kept in | |||
your mutt folder. | |||
- `dialog` is no longer used and the interface is simply text commands. | |||
- More autogenerated shortcuts that allow quickly moving and copying mail | |||
between boxes. | |||
- More elegant attachment handling. Image/video/pdf attachments without relying | |||
on the neomutt instance. | |||
- abook integration by default. | |||
- The messy template files and other directories have been moved or removed, leaving a clean config folder. | |||
- msmtp configs moved to `~/.config/` and mail default location moved to `~/.local/share/mail/`, reducing mess in `~`. | |||
- The messy template files and other directories have been moved or removed, | |||
leaving a clean config folder. | |||
- msmtp configs moved to `~/.config/` and mail default location moved to | |||
`~/.local/share/mail/`, reducing mess in `~`. | |||
- `pass` is used as a password manager instead of separately saving passwords. | |||
- Script is POSIX sh compliant. | |||
- Error handling for the many people who don't read or follow directions. Less errors generally. | |||
- Error handling for the many people who don't read or follow directions. Fewer | |||
errors generally. | |||
- Addition of a manual `man mw` | |||
- Now handles POP protocol via `mpop` for those who prefer it (add an account | |||
with the `-p` option). POP configs are still generated automatically. | |||
## Help the Project! | |||
- Try mutt-wizard out on weird machines and weird email addresses and report any errors. | |||
- Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. | |||
- If nothing else, [Donate!](https://paypal.me/LukeMSmith) | |||
See Luke's website [here](https://lukesmith.xyz). Email him at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). | |||
mutt-wizard is free/libre software, licensed under the GPLv3. | |||
- Try mutt-wizard out on weird machines and weird email addresses and report any | |||
errors. | |||
- Open a PR to add new server information into `domains.csv` so their users can | |||
more easily use mutt-wizard. | |||
- If nothing else, donate: | |||
- XMR: `8AzeWXhJvYJ1VeENHcNXCR1dLMgDALreZ1BdooZVjRKndv6myr3t1ue6C4ML2an5fWSpcP1sTDA9nKUMevkukDXG6chRjNv` | |||
- BTC: `bc1qacqfp36ffv9mafechmvk8f6r8qy4tual6rcm9p` | |||
## Details for Tinkerers | |||
- The critical `mutt`/`neomutt` files are in `~/.config/mutt/`. | |||
- Put whatever global settings you want in `muttrc`. mutt-wizard will add some lines to this file which you shouldn't remove unless you know what you're doing, but you can move them up/down over your personal config lines if you need to. If you get binding conflict errors in mutt, you might need to do this. | |||
- Each of the accounts that mutt-wizard generates will have custom settings set in a separate file in `accounts/`. You can edit these freely if you want to tinker with settings specific to an account. | |||
- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if you wish. | |||
## Watch out for these things: | |||
- Gmail accounts can now create 'App Password' to use with """less secure""" applications. This password is single use (ie. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. | |||
- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note that when mutt-wizard asks for a password, you should put in your [bridge password](https://protonmail.com/bridge/thunderbird#3), not your account password. | |||
- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. It might help to [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. | |||
- If you have a university email, or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. | |||
- `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled (although sync should succeed). `mw` will also not autocreate mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. | |||
## To-do | |||
- Add ~~Mac OS~~/~~BSD~~ compatibility (the script is confirmed to work for Mac OS and FreeBSD now) | |||
- ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM) | |||
- Put whatever global settings you want in `muttrc`. mutt-wizard will add some | |||
lines to this file, which you shouldn't remove unless you know what you're | |||
doing, but you can move them up/down over your config lines if you need to. If | |||
you get binding conflict errors in mutt, you might need to do this. | |||
- Each of the accounts that mutt-wizard generates will have custom settings set | |||
in a separate file in `accounts/`. You can edit these freely if you want to | |||
tinker with settings specific to an account. | |||
- In `/usr/share/mutt-wizard` are several global config files, including | |||
`mutt-wizard`'s default settings. You can override this in your `muttrc` if | |||
you wish. | |||
## Watch out for these things | |||
- Gmail accounts need to create an | |||
[App Password](https://support.google.com/accounts/answer/185833?hl=en) to | |||
use with "less secure" applications. This password is single-use (i.e. | |||
for setup) and will be stored and encrypted locally. Enabling third-party | |||
applications requires turning off two-factor authentication and this will | |||
circumvent that. You might also need to manually "Enable IMAP" in the | |||
settings. | |||
- If you have a university email or enterprise-hosted email for work, there | |||
might be other hurdles or two-factor authentication you have to jump through. | |||
Some, for example, will want you to create a separate IMAP password, etc. | |||
- `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled | |||
(although sync should succeed). `mw` will also not auto-create mailbox | |||
shortcuts since it is looking for English mailbox names. I strongly recommend | |||
you to set your email language to English on your mail server to avoid these | |||
problems. | |||
## License | |||
mutt-wizard is free/libre software. This program is released under the GPLv3 | |||
license, which you can find in the file [LICENSE](LICENSE). |
@@ -1,71 +1,85 @@ | |||
#!/bin/sh | |||
# Sync mail and give notification if there is new mail. | |||
# - Syncs mail for all accounts, or a single account given as an argument. | |||
# - Displays a notification showing the number of new mails. | |||
# - Displays a notification for each new mail with its subject displayed. | |||
# - Runs notmuch to index new mail. | |||
# - This script can be set up as a cron job for automated mail syncing. | |||
# There are many arbitrary and ugly features in this script because it is | |||
# inherently difficult to pass environmental variables to cronjobs and other | |||
# issues. It also should at least be compatible with Linux (and maybe BSD) with | |||
# Xorg and MacOS as well. | |||
# Run only if user logged in (prevent cron errors) | |||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} | |||
# Run only if not already running in other instance | |||
pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} | |||
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} | |||
# First, we have to get the right variables for the mbsync file, the pass | |||
# archive, notmuch and the GPG home. This is done by searching common profile | |||
# files for variable assignments. This is ugly, but there are few options that | |||
# will work on the maximum number of machines. | |||
eval "$(grep -h -- \ | |||
"^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ | |||
"$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ | |||
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ | |||
"$HOME/.pam_environment" 2>/dev/null)" | |||
# Checks for internet connection and set notification script. | |||
ping -q -c 1 1.1.1.1 > /dev/null || ping -q -c 1 1.0.0.1 > /dev/null || ping -q -c 1 example.org || { echo "No internet connection detected."; exit ;} | |||
command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." | |||
export GPG_TTY="$(tty)" | |||
# Required to display notifications if run as a cronjob: | |||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus | |||
export DISPLAY=:0.0 | |||
[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" | |||
# For individual configurations: | |||
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" | |||
lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | |||
# Settings are different for MacOS (Darwin) systems. | |||
if [ "$(uname)" = "Darwin" ]; then | |||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} | |||
messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} | |||
else | |||
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | |||
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;} | |||
fi | |||
case "$(uname)" in | |||
Darwin) | |||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} | |||
;; | |||
*) | |||
case "$(readlink -f /sbin/init)" in | |||
*systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; | |||
esac | |||
# remember if a display server is running since `ps` doesn't always contain a display | |||
pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" | |||
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" | |||
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do | |||
export DISPLAY=$x | |||
notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account." | |||
done ;} | |||
;; | |||
esac | |||
# Check account for new mail. Notify if there is new content. | |||
syncandnotify() { | |||
acc="$(echo "$account" | sed "s/.*\///")" | |||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi | |||
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) | |||
new=$(find\ | |||
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/new/\ | |||
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/cur/\ | |||
-type f -newer "$lastrun" 2> /dev/null) | |||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | |||
if [ "$newcount" -gt "0" ]; then | |||
notify "$acc" "$newcount" & | |||
for file in $new; do | |||
# Extract subject and sender from mail. | |||
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') | |||
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') | |||
messageinfo & | |||
done | |||
fi | |||
case 1 in | |||
$((newcount > 0)) ) notify "$acc" "$newcount" ;; | |||
esac | |||
} | |||
# Sync accounts passed as argument or all. | |||
if [ "$#" -eq "0" ]; then | |||
accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")" | |||
else | |||
if [ "$#" -gt "0" ]; then | |||
for arg in "$@"; do | |||
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 | |||
done | |||
accounts=$* | |||
fi | |||
( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | |||
[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" | |||
# Parallelize multiple accounts | |||
for account in $accounts | |||
do | |||
for account in $accounts; do | |||
syncandnotify & | |||
done | |||
wait | |||
( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | |||
notmuch new 2>/dev/null | |||
notmuch new --quiet | |||
#Create a touch file that indicates the time of the last run of mailsync | |||
touch "$HOME/.config/mutt/.mailsynclastrun" | |||
touch "$lastrun" |
@@ -1,332 +1,247 @@ | |||
#!/bin/sh | |||
command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" | |||
[ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" | |||
[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && | |||
"$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || { | |||
printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" | |||
exit | |||
} | |||
! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit | |||
prefix="/usr/local" | |||
muttdir="$HOME/.config/mutt" # Main mutt config location | |||
accdir="$muttdir/accounts" # Directory for account settings | |||
maildir="$HOME/.local/share/mail" # Location of mail storage | |||
namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username | |||
emailre=".\+@.\+\\..\+" # Regex to confirm valid email address | |||
maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" | |||
muttshare="$prefix/share/mutt-wizard" | |||
mbsyncrc="$HOME/.mbsyncrc" | |||
mwconfig="$muttshare/mutt-wizard.muttrc" | |||
cachedir="$HOME/.cache/mutt-wizard" | |||
muttrc="$muttdir/muttrc" | |||
msmtprc="$HOME/.config/msmtp/config" | |||
ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail | |||
for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" | |||
do | |||
cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" | |||
muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" | |||
accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" | |||
msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" | |||
msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/msmtp/msmtp.log" | |||
mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" | |||
mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" | |||
alias mbsync='mbsync -c "$mbsyncrc"' | |||
# On Ubuntu/Debian, a link is needed since they use an older version. | |||
if command -V apt-get >/dev/null 2>&1; then | |||
master="Master" | |||
slave="Slave" | |||
fi | |||
for x in "/etc/ssl/certs/ca-certificates.crt" \ | |||
"/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/cert.pem" \ | |||
"/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" \ | |||
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \ | |||
"/usr/local/share/ca-certificates/"; do | |||
[ -f "$x" ] && sslcert="$x" && break | |||
done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;} | |||
getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\..*//" | sort -n)" ;} | |||
list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} | |||
checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" | |||
PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}" | |||
[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || { | |||
echo "First run \`pass init <yourgpgemail>\` to set up a password archive." | |||
echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)" | |||
exit 1 ;} ;} | |||
getprofiles() { \ | |||
unset msmtp_header msmtp_profile mutt_profile mbsync_profile | |||
printf "Creating profiles for \`%s\`..." "$title" | |||
msmtp_header="defaults | |||
auth on | |||
tls on | |||
tls_trust_file $sslcert | |||
logfile ~/.config/msmtp/msmtp.log | |||
" | |||
msmtp_profile="account $title | |||
getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)" ;} | |||
list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} | |||
prepmsmtp() { mkdir -p "${msmtprc%/*}" "${msmtplog%/*}" | |||
ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null | |||
echo "account $fulladdr | |||
host $smtp | |||
port $sport | |||
port ${sport:-465} | |||
from $fulladdr | |||
user $login | |||
passwordeval \"pass mutt-wizard-$title\" | |||
$starttlsoff | |||
" | |||
mbsync_profile="IMAPStore $title-remote | |||
passwordeval \"pass $passprefix$fulladdr\" | |||
auth ${auth:-on} | |||
tls on | |||
tls_trust_file $sslcert | |||
logfile $msmtplog | |||
${tlsline:-tls_starttls off} | |||
" >> "$msmtprc" | |||
} | |||
prepmbsync() { mkdir -p "${mbsyncrc%/*}" | |||
echo " | |||
IMAPStore $fulladdr-remote | |||
Host $imap | |||
Port $iport | |||
Port ${iport:-993} | |||
User $login | |||
PassCmd \"pass mutt-wizard-$title\" | |||
PassCmd \"pass $passprefix$fulladdr\" | |||
AuthMechs LOGIN | |||
SSLType $ssltype | |||
SSLType ${imapssl:-IMAPS} | |||
CertificateFile $sslcert | |||
MaildirStore $title-local | |||
MaildirStore $fulladdr-local | |||
Subfolders Verbatim | |||
Path ~/.local/share/mail/$title/ | |||
Inbox ~/.local/share/mail/$title/INBOX | |||
Flatten . | |||
Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/ | |||
Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} | |||
Channel $title | |||
Channel $fulladdr | |||
Expunge Both | |||
Master :$title-remote: | |||
Slave :$title-local: | |||
${master:-Far} :$fulladdr-remote: | |||
${slave:-Near} :$fulladdr-local: | |||
Patterns * !\"[Gmail]/All Mail\" | |||
Create Both | |||
SyncState * | |||
MaxMessages $maxmes | |||
MaxMessages ${maxmes:-0} | |||
ExpireUnread no | |||
# End profile | |||
" | |||
" >> "$mbsyncrc" ;} | |||
prepmpop() { mkdir -p "${mpoprc%/*}" | |||
echo " | |||
account $fulladdr | |||
tls on | |||
user $login | |||
host $imap | |||
delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} | |||
passwordeval pass $passprefix$fulladdr | |||
" >> "$mpoprc" ;} | |||
if [ "$accounttype" = "offline" ]; then | |||
mutt_profile="# vim: filetype=neomuttrc | |||
# muttrc file for account $title | |||
prepmutt() { mkdir -p "${muttrc%/*}" "$accdir" | |||
echo "# vim: filetype=neomuttrc | |||
# muttrc file for account $fulladdr | |||
set realname = \"$realname\" | |||
set from = \"$fulladdr\" | |||
set sendmail = \"msmtp -a $title\" | |||
set sendmail = \"msmtp -a $fulladdr\" | |||
alias me $realname <$fulladdr> | |||
set folder = \"$maildir/$title\" | |||
set header_cache = $cachedir/$title/headers | |||
set message_cachedir = $cachedir/$title/bodies | |||
set folder = \"$folder\" | |||
set header_cache = $cachedir/$fulladdr/headers | |||
set message_cachedir = $cachedir/$fulladdr/bodies | |||
set mbox_type = Maildir | |||
set hostname = \"$hostname\" | |||
source $muttshare/switch.muttrc | |||
set spoolfile = "+INBOX" | |||
set postponed = "+Drafts" | |||
set trash = "+Trash" | |||
set record = "+Sent" | |||
$extra | |||
$synccmd | |||
macro index \eg \"<enter-command>unset wait_key<enter><shell-escape>gpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; $prefix/libexec/gpg-wks-client --create \\\$eFGPT \\\$eID | msmtp --read-envelope-from --read-recipients -a $fulladdr<enter>\" \"publish GPG key to WKS provider\" | |||
macro index \eh \"<pipe-message>$prefix/libexec/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a $fulladdr<enter>\" \"confirm GPG publication\" | |||
" > "$accdir/$fulladdr.muttrc" | |||
set crypt_autosign = yes | |||
set crypt_opportunistic_encrypt = yes | |||
set pgp_self_encrypt = yes | |||
set pgp_default_key = $keyid | |||
bind index,pager gg noop | |||
bind index,pager g noop | |||
bind index,pager M noop | |||
bind index,pager C noop | |||
bind index gg first-entry | |||
macro index o \"<shell-escape>mailsync -V $title<enter>\" \"run mbsync to sync $title\" | |||
unmailboxes * | |||
" | |||
else | |||
mutt_profile="# vim: filetype=neomuttrc | |||
# muttrc file for account $title | |||
set realname = \"$realname\" | |||
set from = \"$fulladdr\" | |||
set sendmail = \"msmtp -a $title\" | |||
alias me $realname <$fulladdr> | |||
set folder = \"imaps://$login@$imap:$iport\" | |||
set imap_user = \"$login\" | |||
set header_cache = $cachedir/$title/headers | |||
set message_cachedir = $cachedir/$title/bodies | |||
set imap_pass = \"\`pass mutt-wizard-$title\`\" | |||
[ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" | |||
! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >> "$muttrc" | |||
! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >> "$muttrc" | |||
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >> "$muttrc" | |||
} | |||
set crypt_autosign = yes | |||
set crypt_opportunistic_encrypt = yes | |||
set pgp_self_encrypt = yes | |||
set pgp_default_key = $keyid | |||
getprofiles() { \ | |||
case "$iport" in | |||
1143) imapssl=None ;; | |||
143) imapssl=STARTTLS ;; | |||
esac | |||
case "$type" in | |||
online) folder="imaps://$login@$imap:${iport:-993}" | |||
extra="set imap_user = \"$login\" | |||
set imap_pass = \"\`pass $passprefix$fulladdr\`\" | |||
set ssl_starttls = yes | |||
set ssl_force_tls = yes" | |||
;; | |||
pop) synccmd="macro index o \"<shell-escape>mpop $fulladdr<enter>\" \"run mpop to get $fulladdr's mail\"" | |||
folder="$maildir/$fulladdr" | |||
prepmpop ;; | |||
*) synccmd="macro index o \"<shell-escape>mw -y $fulladdr<enter>\" \"run mbsync to sync $fulladdr\"" | |||
folder="$maildir/$fulladdr" | |||
prepmbsync ;; | |||
esac | |||
prepmsmtp | |||
prepmutt | |||
prepnotmuch # Create a notmuch config file if not present already. | |||
} | |||
parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" | |||
set mbox_type = Maildir | |||
set ssl_starttls = yes | |||
set ssl_force_tls = yes | |||
bind index,pager gg noop | |||
bind index,pager g noop | |||
bind index,pager M noop | |||
bind index,pager C noop | |||
bind index gg first-entry | |||
unmailboxes * | |||
" | |||
fi | |||
printf "DONE.\\n" | |||
[ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" | |||
IFS=, read -r service imapsugg iportsugg smtpsugg sportsugg <<EOF | |||
$serverinfo | |||
EOF | |||
imap="${imap:-$imapsugg}" | |||
smtp="${smtp:-$smtpsugg}" | |||
sport="${sport:-$sportsugg}" | |||
iport="${iport:-$iportsugg}" | |||
} | |||
delete() { if [ -z "${fulladdr+x}" ]; then | |||
echo "Select the account you would like to delete (by number):" | |||
list || exit 1 | |||
read -r input | |||
match="^\s*$input\s\+" | |||
else | |||
match="\s\+$fulladdr$" | |||
getaccounts | |||
fi | |||
fulladdr="$(echo "$accounts" | grep "$match" | grep -o "\S*@\S*")" | |||
[ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1 | |||
sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null ; rm -f "$mbsyncrc"bu | |||
rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc" | |||
sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu | |||
sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu | |||
sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu | |||
pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 | |||
[ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" | |||
for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do | |||
sed -ibu 'N;/^\n$/D;P;D;' "$file" 2>/dev/null; rm -f "$file"bu | |||
done | |||
} | |||
askinfo() { \ | |||
printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" | |||
read -r fulladdr | |||
keyid=$("$GPG" --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }') | |||
printf "\033[0m" | |||
while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do | |||
printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" | |||
[ -z "$fulladdr" ] && echo "Give the full email address to add:" && | |||
read -r fulladdr | |||
while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do | |||
echo "$fulladdr is not a valid email address. Please retype the address:" | |||
read -r fulladdr | |||
printf "\033[0m" | |||
done | |||
domain="$(echo "$fulladdr" | sed "s/.*@//")" | |||
search_query=$domain | |||
case "$domain" in | |||
protonmail.com|protonmail.ch|pm.me) | |||
search_query='protonmail.com' ;; | |||
*) | |||
while : ; do | |||
printf "\nIs your email hosted with Protonmail? [yes/no] " | |||
read -r is_protonmail | |||
case $is_protonmail in | |||
[Yy][Ee][Ss]) search_query='protonmail.com' && break;; | |||
[Nn][Oo]) break;; | |||
*) printf 'Please answer Yes or No' | |||
esac; done; | |||
esac | |||
printf "\\nSearching for \033[32m%s\033[0m in \033[34m\`domains.csv\`\033[0m..." "$domain" | |||
serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" | |||
if [ -z "$serverinfo" ]; then | |||
printf "Your email domain is not in mutt-wizard's database yet.\\nmutt-wizard will still autoconfigure everything, but you will have to manually type in your service's IMAP and SMTP server information.\\nYou can usually quickly find this by internet searching for it.\\n" | |||
printf "Insert the IMAP server for your email provider (excluding the port number)\\n\033[36m\t" | |||
getaccounts; echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null && | |||
{ echo "$fulladdr has already been added" && exit 1 ;} | |||
{ [ -z "$imap" ] || [ -z "$smtp" ] ;} && parsedomains | |||
[ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" && | |||
read -r imap | |||
printf "\033[0mWhat is your server's IMAP port number? (Usually something like 993)\\n\033[36m\t" | |||
read -r iport | |||
printf "\033[0mInsert the SMTP server for your email provider (excluding the port number)\\n\033[36m\t" | |||
[ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && | |||
read -r smtp | |||
printf "\033[0mWhat is your server's SMTP port number? (Usually 587 or 465)\\n\033[36m\t" | |||
read -r sport | |||
printf "\033[0m\\nGreat! If you want to be helpful, copy the line below and you can add it to the \`domains.csv\` file on Github.\\nThis will make things easier for others who use your email provider.\\n\\n%s,%s,%s,%s,%s\\n\\nAlthough be sure to test to see if these settings work first! ;-)\\n" "$domain" "$imap" "$iport" "$smtp" "$sport" | |||
[ "$sport" = 587 ] && tlsline="# tls_starttls" | |||
[ -z "$realname" ] && realname="${fulladdr%%@*}" | |||
[ -z "$passprefix" ] && passprefix="" | |||
hostname="${fulladdr#*@}" | |||
login="${login:-$fulladdr}" | |||
if [ -n "${password+x}" ]; then | |||
createpass | |||
else | |||
IFS=, read -r service imap iport smtp sport <<EOF | |||
$serverinfo | |||
EOF | |||
printf "\\n\033[3;33mCongrats!\033[0m Server info has automatically been found, so you won't have to look anything up!\\n\t\033[1mIMAP server\033[0m: %s\\n\t\033[1mIMAP port\033[0m: %s\\n\t\033[1mSMTP server\033[0m: %s\\n\t\033[1mSMTP port\033[0m: %s\\nThis data will be used by the wizard.\\n" "$imap" "$iport" "$smtp" "$sport" | |||
case "$service" in | |||
gmail.com) printf "\033[31mREMEMBER: Gmail users must enable \"less secure\" (third-party) applications first for the sync to work:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;; | |||
protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;; | |||
esac | |||
[ "$sport" = 465 ] && starttlsoff="tls_starttls off" | |||
getpass | |||
fi | |||
printf "Enter the \033[35mfull name\033[0m you want to be identified by on this account.\\n\tReal name: " | |||
read -r realname | |||
printf "Enter a short, \033[36mone-word identifier\033[0m for this email account that will distinguish them from any other accounts you add.\\n\tAccount name: " | |||
read -r title | |||
while ! echo "$title" | grep "$namere" >/dev/null || ls "$accdir"/[0-9]"-$title.muttrc" >/dev/null 2>&1; do | |||
printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or - and that you have \033[1mnot\033[0m used before.\\n\tAccount name: \033[36m\t" | |||
read -r title | |||
printf "\033[0m" | |||
done | |||
printf "If your account has a special username different from your address, insert it now. Otherwise leave this prompt totally blank.\\n\033[34mMost accounts will not have a separate login, so you should probably leave this blank.\033[0m\\n\tLogin(?): \033[36m" | |||
read -r login | |||
printf "\033[0m" | |||
[ -z "$login" ] && login="$fulladdr" | |||
[ "$accounttype" = "offline" ] && printf "If you want to limit the number of messages kept offline to a number, enter that number below. If you do not want to limit your mail and would like \`mbsync\` to sync all mail, press enter without typing a number.\\n\t" && read -r maxmes | |||
echo "$maxmes" | grep "[1-9]" >/dev/null || maxmes="0" | |||
getpass | |||
getprofiles | |||
mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "$HOME/.config/msmtp" | |||
getaccounts | |||
for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done | |||
[ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" | |||
echo "$msmtp_profile" >> "$msmtprc" | |||
command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null | |||
case "$service" in | |||
protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; | |||
esac | |||
echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" | |||
echo "$mbsync_profile" >> "$mbsyncrc" | |||
notmuchauto | |||
[ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." | |||
! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc" | |||
! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc # mw-autogenerated" >> "$muttrc" | |||
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$idnum-$title.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" | |||
} | |||
protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" | |||
fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" | |||
sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu | |||
} | |||
createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$passprefix$fulladdr" | |||
"$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr" | |||
rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;} | |||
getpass() { while : ; do pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 | |||
pass insert -f "$passprefix$fulladdr" && break; done ;} | |||
getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 | |||
pass insert "mutt-wizard-$title" && break; done ;} | |||
formatShortcut() { \ | |||
while read -r data; do { echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"go to $2\" # mw-autogenerated" | |||
echo "macro index,pager M$1 \";<save-message>$data<enter>\" \"move mail to $2\" # mw-autogenerated" | |||
echo "macro index,pager C$1 \";<copy-message>$data<enter>\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" | |||
done ;} | |||
tryconnect() { mkdir -p "$maildir/$title" | |||
if mailboxes="$(mbsync -l "$title" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then | |||
[ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu | |||
printf "\033[32mMailboxes detected.\033[0m\\n" | |||
echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$title/{}" | |||
return 0 | |||
getboxes() { if [ -n "${force+x}" ] ; then | |||
mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" | |||
else | |||
printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n" | |||
return 1 | |||
fi ;} | |||
finalize() { \ | |||
boxes="$(find "$maildir/$title/" -mindepth 1 -type d | sed "s/\ /\\\ /g;s/^.*\//=/;/=\(cur\|new\|tmp\)$/d")" | |||
[ -z "$boxes" ] && printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$title" && return | |||
printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" | |||
spoolfile=$(echo "$boxes" | grep -i -m 1 inbox | sed 's/=/+/g') | |||
record=$(echo "$boxes" | grep -i -m 1 sent | sed 's/=/+/g') | |||
postponed=$(echo "$boxes" | grep -i -m 1 draft | sed 's/=/+/g') | |||
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g') | |||
sed -ibu "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" | |||
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc" | |||
echo "mailboxes $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" | |||
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" | |||
sed -ibu "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" | |||
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox | |||
echo "$boxes" | grep -i sent | head -n 1 | formatShortcut s sent | |||
echo "$boxes" | grep -i draft | head -n 1 | formatShortcut d drafts | |||
echo "$boxes" | grep -i trash | head -n 1 | formatShortcut t trash | |||
echo "$boxes" | grep -i spam | head -n 1 | formatShortcut S spam | |||
echo "$boxes" | grep -i junk | head -n 1 | formatShortcut j junk | |||
echo "$boxes" | grep -i archive | head -n 1 | formatShortcut a archive | |||
[ "$accounttype" = "offline" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" | |||
command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" | |||
return 0 | |||
info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" | |||
[ -z "$info" ] && echo "Log-on not successful." && return 1 | |||
mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" | |||
fi | |||
[ "$type" = "pop" ] && mailboxes="INBOX" | |||
for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u; echo 0); do | |||
idnum=$((idnum + 1)) | |||
[ "$idnum" -eq "$x" ] || break | |||
done | |||
toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" | |||
} | |||
confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 | |||
printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 | |||
return 0 ;} | |||
pick() { printf "Select an accounts to %s:\\n" "$1" | |||
list | |||
read -r input | |||
[ -z "$input" ] && return 1 | |||
title="$(echo "$accounts" | grep "$input" | awk '{print $2}')" | |||
[ -z "$title" ] && printf "Invalid response." && return 1 | |||
finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" | |||
[ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" | |||
echo "$fulladdr (account #$idnum) added successfully." | |||
command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" | |||
return 0 ;} | |||
delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu | |||
rm -rf "${cachedir:?}/${title:?}" "$accdir/"[1-9]"-$title.muttrc" | |||
sed -ibu "/[0-9]-$title.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu | |||
sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu | |||
} | |||
choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1 | |||
if crontab -l | grep mailsync >/dev/null; then | |||
echo "Active mail sync cronjob detected. Do you want to remove it?" | |||
printf "\033[36m\t" | |||
read -r rmyn | |||
printf "\033[0m" | |||
echo "$rmyn" | grep -i "^y\(es\)*$" >/dev/null && crontab -l | sed '/mailsync/d' | crontab - >/dev/null && echo "Mail sync turned off." | |||
else | |||
echo "How many minutes between each mail sync?" | |||
printf "\033[36m\t" | |||
read -r minnum | |||
printf "\033[0m" | |||
while ! echo "$minnum" | grep "^[0-9]\+$" >/dev/null; do | |||
printf "That doesn't look like a number. How many minutes between each mail sync?\\n\033[36m\t" | |||
read -r minnum | |||
printf "\033[0m" | |||
done | |||
(crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3) >/dev/null 2>&1") | crontab - >/dev/null && | |||
echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." | |||
fi ;} | |||
asktype() { while : ; do | |||
printf "Do you want to keep your mail for this account offline with mbsync? [yes/no]\\n\t" | |||
read -r offnot | |||
case "$offnot" in | |||
[Yy][Ee][Ss]) accounttype="offline" && break ;; | |||
[Nn][Oo]) accounttype="online" && break ;; | |||
*) echo "Write out either yes or no completely. Try again or press ctrl-c to quit." ;; | |||
esac; done ;} | |||
purge() { confirm "delete all account data" || exit | |||
rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" | |||
crontab -l | sed '/mailsync/d' | crontab - >/dev/null | |||
echo "All configs and account settings have been purged." | |||
sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu | |||
} | |||
notmuchauto() { \ | |||
prepnotmuch() { \ | |||
[ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" | |||
[ -f "$NOTMUCH_CONFIG" ] && return 0 | |||
nmbasic="[database] | |||
echo "[database] | |||
path=$maildir | |||
[user] | |||
name=$realname | |||
@@ -339,31 +254,118 @@ exclude_tags=deleted;spam; | |||
[maildir] | |||
synchronize_flags=true | |||
[crypto] | |||
gpg_path=$GPG" | |||
echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} | |||
trap 'echo -e "\033[0m\n"; exit' INT ABRT | |||
case "$1" in | |||
ls) list ;; | |||
add) asktype && askinfo && tryconnect && finalize || delete ;; | |||
pass) pick "change the password of" && getpass ;; | |||
delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; | |||
purge) purge ;; | |||
cron) choosecron ;; | |||
*) cat << EOF | |||
gpg_path=$GPG" > "$NOTMUCH_CONFIG" ;} | |||
togglecron() { cron="$(mktemp)" | |||
crontab -l > "$cron" | |||
if grep -q mailsync "$cron"; then | |||
echo "Removing automatic mailsync..." | |||
sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu | |||
else | |||
echo "Adding automatic mailsync every ${cronmin:-10} minutes..." | |||
echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync -q" >> "$cron" | |||
fi && | |||
crontab "$cron"; rm -f "$cron" ;} | |||
setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then | |||
echo "Running $1 with $action..." | |||
echo "Incompatible options given. Only one action may be specified per run." | |||
return 1 | |||
else | |||
action="$1" | |||
fi; } | |||
mwinfo() { cat << EOF | |||
mw: mutt-wizard, auto-configure email accounts for mutt | |||
including downloadable mail with \`isync\`. | |||
Allowed options: | |||
add Add and autoconfigure an email address (9 max.) | |||
ls List configured accounts | |||
delete Pick an account to delete | |||
purge Delete all accounts and settings | |||
cron Enable or disable an autosync via cronjob | |||
all else Print this message | |||
Main actions: | |||
-a your@email.com Add an email address | |||
-l List email addresses configured | |||
-d Remove an already added address | |||
-D your@email.com Force remove account without confirmation | |||
-y your@email.com Sync mail for account by name | |||
-Y Sync mail for all accounts | |||
-t number Toggle automatic mailsync every <number> minutes | |||
-T Toggle automatic mailsync | |||
-r Reorder account numbers | |||
Options allowed with -a: | |||
-u Account login name if not full address | |||
-n "Real name" to be on the email account | |||
-i IMAP/POP server address | |||
-I IMAP/POP server port | |||
-s SMTP server address | |||
-S SMTP server port | |||
-x Password for account (recommended to be in double quotes) | |||
-P Pass Prefix (prefix of the file where password is stored) | |||
-p Add for a POP server instead of IMAP. | |||
-X Delete an account's local email too when deleting. | |||
-o Configure address, but keep mail online. | |||
-f Assume typical English mailboxes without attempting log-on. | |||
NOTE: Once at least one account is added, you can run | |||
\`mbsync -a\` to begin downloading mail. | |||
To change an account's password, run \`pass edit '$passprefix'your@email.com\`. | |||
EOF | |||
} | |||
reorder() { | |||
tempfile="$(mktemp -u)" | |||
trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT | |||
echo "# Carefully reorder these accounts with the desired numbers in the first column. | |||
# DO NOT reorder rows or rename the accounts in the second column." > "$tempfile" | |||
sed -n " | |||
/ i[0-9] / s?\(.* i\|'<sync.*/\|\.muttrc.*\)??g p | |||
" "$muttrc" >> "$tempfile" | |||
${EDITOR:-vim} "$tempfile" || exit 1 | |||
sed -i -e 's/#.*//' -e '/^$/d' "$tempfile" | |||
default="$(sort -n "$tempfile" | head -n 1)" | |||
default="${default#* }" | |||
sed -ibu " | |||
/.* i[0-9] .*.muttrc/d | |||
/^source.*accounts.*.muttrc/d | |||
" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu | |||
awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" } | |||
{ | |||
print "macro index,pager i"$1" '\''<sync-mailbox><enter-command>source "a"/"$2".muttrc<enter><change-folder>!<enter>;<check-stats>'\'' \"switch to "$2"\"" | |||
} | |||
' "$tempfile" >> "$muttrc" | |||
} | |||
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in | |||
l) setact list || exit 1 ;; | |||
r) setact reorder || exit 1 ;; | |||
d) setact delete || exit 1 ;; | |||
D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; | |||
y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; | |||
Y) setact sync || exit 1 ;; | |||
a) setact add || exit 1 ; fulladdr="$OPTARG" ;; | |||
i) setact add || exit 1 ; imap="$OPTARG" ;; | |||
I) setact add || exit 1 ; iport="$OPTARG" ;; | |||
s) setact add || exit 1 ; smtp="$OPTARG" ;; | |||
S) setact add || exit 1 ; sport="$OPTARG" ;; | |||
u) setact add || exit 1 ; login="$OPTARG" ;; | |||
n) setact add || exit 1 ; realname="$OPTARG" ;; | |||
P) setact add || exit 1 ; passprefix="$OPTARG" ;; | |||
m) setact add || exit 1 ; maxmes="$OPTARG" ;; | |||
o) setact add || exit 1 ; type="online" ;; | |||
p) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; | |||
f) setact add || exit 1 ; force=True ;; | |||
x) setact add || exit 1 ; password="$OPTARG" ;; | |||
X) setact delete || exit 1 ; purge=True ;; | |||
t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; | |||
T) setact toggle || exit 1 ;; | |||
*) mwinfo; exit 1 ;; | |||
esac done | |||
case "$action" in | |||
list) list ;; | |||
add) checkbasics && askinfo && getboxes && getprofiles && finalize ;; | |||
delete) delete ;; | |||
sync) mailsync $fulladdr ;; | |||
toggle) togglecron ;; | |||
reorder) reorder ;; | |||
*) mwinfo; exit 1 ;; | |||
esac |
@@ -1,9 +0,0 @@ | |||
#!/bin/sh | |||
# Helps open a file with xdg-open from mutt in a external program without weird side effects. | |||
[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open" | |||
mkdir -p "/tmp/$USER-mutt-tmp" | |||
file="/tmp/$USER-mutt-tmp/$(basename "$1")" | |||
rm -f "$file" | |||
cp "$1" "$file" | |||
$opener "$file" >/dev/null 2>&1 & |
@@ -0,0 +1,10 @@ | |||
#!/bin/sh | |||
# Helps open a file with xdg-open from mutt in a external program without weird side effects. | |||
tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" | |||
file="$tempdir/${1##*/}" | |||
[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" | |||
mkdir -p "$tempdir" | |||
cp -f "$1" "$file" | |||
$opener "$file" >/dev/null 2>&1 | |||
find "${tempdir:?}" -mtime +1 -type f -delete |
@@ -0,0 +1,60 @@ | |||
.TH MAILSYNC 1 | |||
.SH NAME | |||
mailsync \- sync mail accounts set up with | |||
.B mw. | |||
.SH SYNOPSIS | |||
.B mailsync | |||
[ | |||
.I OPTIONS | |||
]... [ | |||
.I ACCOUNTS | |||
] | |||
.SH DESCRIPTION | |||
.B mailsync | |||
syncs the mail of all accounts set up with | |||
.B | |||
mw, | |||
or if account names are given, syncs only those accounts. | |||
.B | |||
mailsync | |||
can also pass on options to | |||
.B | |||
mbsync, | |||
which it uses to sync mail. | |||
.B | |||
mailsync | |||
is a wrapper for | |||
.B mbsync, | |||
but also automatically reindexes new mail with | |||
.B notmuch, | |||
gives notifications if new mail is found and can also be set as a cronjob to sync and index mail quietly in the background. | |||
.SH COMMANDS | |||
.TP | |||
.B mailsync | |||
sync all mail accounts and notify user if there is new mail | |||
.TP | |||
.B mailsync account@example.org | |||
only sync the | |||
.B account@example.org | |||
account. | |||
.TP | |||
.B | |||
-* | |||
See the | |||
.B | |||
mbsync | |||
manual for aditional options that can be used. | |||
.SH AUTHORS | |||
Written by Luke Smith <luke@lukesmith.xyz> originally in 2018. | |||
.SH LICENSE | |||
GPLv3 | |||
.SH SEE ALSO | |||
.BR mw (1), | |||
.BR neomutt (1), | |||
.BR neomuttrc (1) | |||
.BR mbsync (1), | |||
.BR mpop (1), | |||
.BR msmtp (1), | |||
.BR notmuch (1), | |||
.BR abook (1) |
@@ -3,7 +3,9 @@ | |||
mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync | |||
.SH SYNOPSIS | |||
.B mw | |||
<command> | |||
[ | |||
.I OPTIONS | |||
] | |||
.SH DESCRIPTION | |||
.B mw | |||
takes a user email account and sets up a terminal-based email interface for it with | |||
@@ -16,24 +18,94 @@ for sending mail, and also passwords automatically encrypted and stored with | |||
.B pass. | |||
.SH COMMANDS | |||
.TP | |||
.B add | |||
configure an email account | |||
.B -a your@email.com | |||
add an email address | |||
.TP | |||
.B ls | |||
.B -l | |||
list all email accounts configured by mutt-wizard | |||
.TP | |||
.B delete | |||
delete the configuration files for an already configured email account | |||
.B -d | |||
pick an already configured account and remove its configuration | |||
.TP | |||
.B purge | |||
totally purge all local mutt-wizard accounts | |||
.B -D your@email.com | |||
remove a configured account without confirmation | |||
.TP | |||
.B cron | |||
toggle a cronjob that will automatically sync mail with | |||
.B mailsync | |||
as often as you wish | |||
.B -y your@email.com | |||
download and upload mail for an email account | |||
.TP | |||
.B -Y | |||
sync all email accounts | |||
.TP | |||
.B -t 15 | |||
toggle a cronjob that syncs your mail every 15 minutes (or any other number under 60) | |||
.TP | |||
.B -T | |||
toggle a cronjob without specifying minutes between sync | |||
.TP | |||
.B -r | |||
reorder account shortcut numbers | |||
.SH OPTIONS FOR ADDING ACCOUNTS | |||
These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. | |||
.TP | |||
.B -u billy | |||
Account logon/username if required and different from email address. | |||
.TP | |||
.B -n Billy | |||
Real name which will appear in emails. Should be put in quotes if multiple words. | |||
.TP | |||
.B -m number | |||
Set a maximum number of messages to be stored offline. | |||
.TP | |||
.B -i | |||
IMAP/POP server address | |||
.TP | |||
.B -I | |||
IMAP/POP server port (assumed to be 993 for IMAP and 995 for POP if not specified) | |||
.TP | |||
.B -s | |||
SMTP server address | |||
.TP | |||
.B -S | |||
SMTP server port (assumed to be 465 if not specified) | |||
.TP | |||
.B -x | |||
Account password. You will be prompted for the password interactively if this option is not given. | |||
.B -P | |||
Pass Prefix. The password will be stored using pass at <passprefix><email> | |||
.SH OTHER OPTIONS | |||
.TP | |||
.B -f | |||
Force account creation and guess mailboxes without attempting to connect to server. Otherwise if connection cannot be made, the configured account settings will not be persistent. | |||
.TP | |||
.B -o | |||
Create settings for an account to be used online only without mail syncing abilities. Without | |||
.B -f | |||
connection will still be attempted in setup to discover mailboxes. | |||
.TP | |||
.B -X | |||
When removing an email profile with either | |||
.I -d | |||
or | |||
.I -D, | |||
also delete the local mail (will not delete the mail on the server). | |||
.TP | |||
.B -p | |||
Use POP protocol instead of IMAP. Requires | |||
.I mpop | |||
to download mail after configuration. Server details can still be given with the | |||
.I -i | |||
and | |||
.I -I | |||
options as if it were a IMAP. | |||
.SH DETAILS | |||
.TP | |||
.B mailsync | |||
mutt-wizard calls a script | |||
.I mailsync | |||
to sync mail. This script additionally indexes new mail with notmuch and gives you a notification if new mail has arrived. If you want to bypass its additional features, you can always just run | |||
.I mbsync -a | |||
to sync your mail directly. | |||
.TP | |||
.B Mail location | |||
If the user chooses to keep offline email with | |||
.B isync, | |||
@@ -52,11 +124,9 @@ and can be edited by the user if needbe. Note that the mutt-wizard will also sou | |||
file. | |||
.TP | |||
.B Mail deletion | |||
Neither | |||
.B delete | |||
or | |||
.B purge | |||
will delete downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. | |||
mutt-wizard's delete action will delete configuration files and | |||
.I not | |||
downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. | |||
.TP | |||
.B Default settings | |||
The mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in | |||
@@ -82,9 +152,8 @@ If you would like to help develop mutt-wizard for others, you are invited to add | |||
on mutt-wizard's Github <https://github.com/lukesmithxyz/mutt-wizard> or Gitlab <https://gitlab.com/lukesmithxyz/mutt-wizard> pages. | |||
.TP | |||
.B Gmail accounts | |||
Google will require you to allow "less-secure" (third party) applications or use two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard <https://support.google.com/accounts/answer/6010255>. | |||
.B Protonmail accounts | |||
Protonmail users must use the Protonmail Bridge <https://protonmail.com/bridge/> to access their IMAP and SMTP servers. This too should be configured before running mutt-wizard. | |||
Google will require you to allow "less-secure" (third party) applications or remove two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard <https://support.google.com/accounts/answer/6010255>. | |||
.TP | |||
.B Enterprise and university accounts | |||
Many universities and businesses might host their domain's email via Google or another service. This often requires a special IMAP/SMTP-specific password that you must generate and use. Again, mutt-wizard can handle these systems, but only once they've been set up. | |||
.TP | |||
@@ -223,9 +292,11 @@ Written by Luke Smith <luke@lukesmith.xyz> originally in 2018. | |||
.SH LICENSE | |||
GPLv3 | |||
.SH SEE ALSO | |||
.BR mailsync (1), | |||
.BR neomutt (1), | |||
.BR neomuttrc (1) | |||
.BR mbsync (1), | |||
.BR mpop (1), | |||
.BR msmtp (1), | |||
.BR notmuch (1), | |||
.BR abook (1) |
@@ -1,4 +1,7 @@ | |||
ADDRESS,IMAP,imap port,SMTP,smtp port | |||
126.com,imap.126.com,993,smtp.126.com,587 | |||
163.com,imap.163.com,993,smtp.163.com,587 | |||
3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 | |||
420blaze.it,mail.cock.li,993,mail.cock.li,587 | |||
8chan.co,mail.cock.li,993,mail.cock.li,587 | |||
aaathats3as.com,mail.cock.li,993,mail.cock.li,587 | |||
@@ -10,10 +13,12 @@ airmail.cc,mail.cock.li,993,mail.cock.li,587 | |||
allergist.com,imap.mail.com,993,smtp.mail.com,587 | |||
alumni.bits-pilani.ac.in,imap.gmail.com,993,smtp.gmail.com,465 | |||
alumni.com,imap.mail.com,993,smtp.mail.com,587 | |||
alumni.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 | |||
alumnidirector.com,imap.mail.com,993,smtp.mail.com,587 | |||
alunos.utfpr.edu.br,imap.gmail.com,993,smtp.gmail.com,587 | |||
anche.no,mail.autistici.org,993,smtp.autistici.org,465 | |||
angelic.com,imap.mail.com,993,smtp.mail.com,587 | |||
anu.edu.au,outlook.office365.com,993,smtp.office365.com,587 | |||
aol.com,imap.aol.com,993,smtp.aol.com,465 | |||
appraiser.net,imap.mail.com,993,smtp.mail.com,587 | |||
aquilenet.fr,imap.aquilenet.fr,993,smtp.aquilenet.fr,587 | |||
@@ -28,18 +33,25 @@ autograf.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
bartender.net,imap.mail.com,993,smtp.mail.com,587 | |||
bastardi.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
beaumccartney.xyz,mail.beaumccartney.xyz,993,mail.beaumccartney.xyz,465 | |||
bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 | |||
bigpond.com,imap.telstra.com,143,smtp.telstra.com,587 | |||
bikerider.com,imap.mail.com,993,smtp.mail.com,587 | |||
billycarlyle.uk,mail.muny.us,993,mail.muny.us,465 | |||
biomed.ee.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 | |||
birdlover.com,imap.mail.com,993,smtp.mail.com,587 | |||
bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 | |||
bocken.org,imap.gmail.com,993,smtp.gmail.com,465 | |||
bocken.org,mail.bocken.org,993,mail.bocken.org,587 | |||
brew-meister.com,imap.mail.com,993,smtp.mail.com,587 | |||
bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
btinternet.com,mail.btinternet.com,993,mail.btinternet.com,587 | |||
calstatela.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
campus.fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 | |||
canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
cash4u.com,imap.mail.com,993,smtp.mail.com,587 | |||
cedars.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465 | |||
ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587 | |||
cheerful.com,imap.mail.com,993,smtp.mail.com,587 | |||
chef.net,imap.mail.com,993,smtp.mail.com,587 | |||
@@ -50,6 +62,7 @@ clasnet.sunyocc.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
clerk.com,imap.mail.com,993,smtp.mail.com,587 | |||
clubmember.org,imap.mail.com,993,smtp.mail.com,587 | |||
cmail.carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
cn.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
cocaine.ninja,mail.cock.li,993,mail.cock.li,587 | |||
cock.email,mail.cock.li,993,mail.cock.li,587 | |||
cock.li,mail.cock.li,993,mail.cock.li,587 | |||
@@ -70,110 +83,81 @@ deliveryman.com,imap.mail.com,993,smtp.mail.com,587 | |||
dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 | |||
dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 | |||
diplomats.com,imap.mail.com,993,smtp.mail.com,587 | |||
dismail.de,imap.dismail.de,993,smtp.dismail.de,465 | |||
disroot.org,disroot.org,993,disroot.org,587 | |||
distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
dorriseaton.com,outlook.office365.com,993,smtp.office365.com,587 | |||
dr.com,imap.mail.com,993,smtp.mail.com,587 | |||
duke.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
e.email,mail.ecloud.global,993,mail.ecloud.global,587 | |||
email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
email.com,imap.mail.com,993,smtp.mail.com,587 | |||
eneco.com,outlook.office365.com,993,smtp.office365.com,587 | |||
engineer.com,imap.mail.com,993,smtp.mail.com,587 | |||
erciyes.edu.tr,posta.erciyes.edu.tr,993,smtp.erciyes.edu.tr,587 | |||
erciyes.edu.tr,mail.erciyes.edu.tr,993,mail.erciyes.edu.tr,587 | |||
ethancoe.com,mail.privateemail.com,993,mail.privateemail.com,465 | |||
ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 | |||
etu.upmc.fr,courriel.upmc.fr,993,smtps.upmc.fr,587 | |||
etu.sorbonne-universite.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-universite.fr,465 | |||
etu.upmc.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-universite.fr,465 | |||
europe.com,imap.mail.com,993,smtp.mail.com,587 | |||
ex-studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 | |||
faks.no,mail.uniweb.no,993,mail.uniweb.no,465 | |||
fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 | |||
fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 | |||
fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 | |||
firemail.cc,mail.cock.li,993,mail.cock.li,587 | |||
forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465 | |||
forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465 | |||
freedom.nl,imap.freedom.nl,993,smtp.freedom.nl,465 | |||
freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465 | |||
fsu-jena,exchange.uni-jena.de,993,smtp.uni-jena.de,587 | |||
gcc.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587 | |||
ghalv.no,mail.ghalv.no,993,mail.ghalv.no,587 | |||
gmail.com,imap.gmail.com,993,smtp.gmail.com,587 | |||
gmx.at,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.com,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.de,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.eu,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.fr,imap.gmx.com,993,mail.gmx.com,587 | |||
gmx.info,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.net,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.org,imap.gmx.net,993,mail.gmx.net,587 | |||
gmx.*,imap.gmx.net,993,mail.gmx.net,587 | |||
go2.pl,poczta.o2.pl,993,poczta.o2.pl,465 | |||
goat.si,mail.cock.li,993,mail.cock.li,587 | |||
googlemail.com,imap.googlemail.com,993,smtp.googlemail.com,587 | |||
gordon.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
grrlz.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
hacari.com,mail.autistici.org,993,smtp.autistici.org,465 | |||
hacari.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
hacari.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
hacari.*,mail.autistici.org,993,smtp.autistici.org,465 | |||
helsinki.fi,outlook.office365.com,993,smtp.helsinki.fi,587 | |||
hhu.de,mail.hhu.de,993,mail.hhu.de,465 | |||
hitler.rocks,mail.cock.li,993,mail.cock.li,587 | |||
horsefucker.org,mail.cock.li,993,mail.cock.li,587 | |||
hostgator,gator4171.hostgator.com,993,gator4171.hostgator.com,587 | |||
hotmail.be,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.cl,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.id,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.il,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.in,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.jp,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.kr,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.th,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.uk,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.co.za,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
hotmail.com.ar,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.au,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.br,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.hk,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.tr,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.tw,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.com.vn,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.cz,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.de,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.dk,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.es,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.fi,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.fr,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.gr,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.hu,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.it,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.lt,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.lv,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.my,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.nl,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.no,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.ph,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.rs,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.se,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.sg,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.sk,outlook.office365.com,993,smtp.office365.com,587 | |||
hotmail.*,outlook.office365.com,993,smtp.office365.com,587 | |||
hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 | |||
humbug.pw,imap.migadu.com,993,smtp.migadu.com,587 | |||
hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 | |||
icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 | |||
ik.me,mail.infomaniak.com,993,mail.infomaniak.com,587 | |||
illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 | |||
in.tum.de,mail.in.tum.de,993,mail.in.tum.de,465 | |||
iname.com,imap.mail.com,993,smtp.mail.com,587 | |||
inbox.lv,mail.inbox.lv,993,mail.inbox.lv,465 | |||
inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 | |||
infomaniak.com,imap.infomaniak.com,993,imap.infomaniak.com,587 | |||
insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
insicuri.net,mail.autistici.org,993,smtp.autistici.org,465 | |||
interactio.io,imap.gmail.com,993,smtp.gmail.com,587 | |||
interia.eu,poczta.interia.pl,993,poczta.interia.pl,465 | |||
interia.pl,poczta.interia.pl,993,poczta.interia.pl,465 | |||
interia.*,poczta.interia.pl,993,poczta.interia.pl,465 | |||
inventati.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
ionos.de,imap.ionos.de,993,smtp.ionos.de,587 | |||
itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
iu.edu,imap.exchange.iu.edu,993,mail-relay.iu.edu,587 | |||
kalli.st,mail.kalli.st,993,kalli.st,587 | |||
kean.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
kipras.org,mail.kipras.org,993,mail.kipras.org,587 | |||
krutt.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
kth.se,webmail.kth.se,993,smtp.kth.se,587 | |||
lancaster.ac.uk,outlook.office365.com,993,smtp.office365.com,587 | |||
larbs.xyz,mail.larbs.xyz,993,mail.larbs.xyz,587 | |||
lavabit.com,lavabit.com,993,lavabit.com,587 | |||
librem.one,imap.librem.one,993,smtp.librem.one,465 | |||
linux.monster,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
linuxmail.org,imap.mail.com,993,smtp.mail.com,587 | |||
live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
live.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
@@ -181,28 +165,40 @@ live.rhul.ac.uk,outlook.office365.com,993,smtp.office365.com,587 | |||
logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 | |||
loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 | |||
lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 | |||
lukesmith.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465 | |||
luther.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 | |||
mace.ac.in,imap.gmail.com,993,smtp.gmail.com,587 | |||
mail.com,imap.mail.com,993,smtp.mail.com,587 | |||
mail.de,imap.mail.de,993,smtp.mail.de,465 | |||
mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
mail.polimi.it,outlook.office365.com,993,smtp.office365.com,587 | |||
mail.ru,imap.mail.ru,993,smtp.mail.ru,465 | |||
mail.utoronto.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,587 | |||
mailbox.tu-dresden.de,msx.tu-dresden.de,993,msx.tu-dresden.de,587 | |||
mailfence.com,imap.mailfence.com,993,smtp.mailfence.com,465 | |||
mailo.com,mail.mailo.com,993,mail.mailo.com,465 | |||
marquette.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
me.com,imap.mail.me.com,993,smtp.mail.me.com,587 | |||
memeware.net,mail.cock.li,993,mail.cock.li,587 | |||
metu.edu.tr,imap.metu.edu.tr,993,smtp.metu.edu.tr,465 | |||
mit.edu,imap.exchange.mit.edu,993,outgoing.mit.edu,465 | |||
ml1.net,imap.fastmail.com,993,smtp.fastmail.com,465 | |||
mortemale.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
msn.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
muny.us,mail.muny.us,993,mail.muny.us,465 | |||
myself.com,imap.mail.com,993,smtp.mail.com,587 | |||
myseneca.ca,outlook.office365.com,993,outlook.office365.com,587 | |||
narod.ru,imap.yandex.com,993,smtp.yandex.com,587 | |||
national.shitposting.agency,mail.cock.li,993,mail.cock.li,587 | |||
ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465 | |||
nigge.rs,mail.cock.li,993,mail.cock.li,587 | |||
niser.ac.in,imap.gmail.com,993,smtp.gmail.com,587 | |||
nixnet.email,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
nixnet.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
nixnetmail.com,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
nuke.africa,mail.cock.li,993,mail.cock.li,587 | |||
nyu.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
o2.pl,poczta.o2.pl,993,poczta.o2.pl,465 | |||
@@ -216,24 +212,24 @@ online.de,imap.1und1.de,993,smtp.1und1.de,465 | |||
op.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
opoczta.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
orange.fr,imap.orange.fr,993,smtp.orange.fr,465 | |||
outlook.at,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
outlook.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
outlook.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
outlook.*,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
outlook.es,outlook.office365.com,993,smtp.office365.com,587 | |||
parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587 | |||
paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
pm.me,127.0.0.1,1143,127.0.0.1,1025 | |||
paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25 | |||
paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 | |||
poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
polimi.it,outlook.office365.com,993,smtp.office365.com,587 | |||
polito.it,mail.polito.it,993,mail.polito.it,465 | |||
polito.it,mail.polito.it,993,mail.polito.it,465 | |||
post.com,imap.mail.com,993,smtp.mail.com,587 | |||
posteo.de,posteo.de,993,posteo.de,587 | |||
posteo.net,posteo.de,993,posteo.de,587 | |||
posteo.*,posteo.de,993,posteo.de,587 | |||
privacy.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 | |||
prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 | |||
protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 | |||
protonmail.com,127.0.0.1,1143,127.0.0.1,1025 | |||
purelymail.com,imap.purelymail.com,993,smtp.purelymail.com,465 | |||
pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587 | |||
qq.com,imap.qq.com,993,smtp.qq.com,587 | |||
rape.lol,mail.cock.li,993,mail.cock.li,587 | |||
redchan.it,mail.cock.li,993,mail.cock.li,587 | |||
resch.pw,mail.resch.pw,993,mail.resch.pw,587 | |||
@@ -242,23 +238,37 @@ rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 | |||
runbox.com,mail.runbox.com,993,mail.runbox.com,587 | |||
rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 | |||
sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 | |||
seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 | |||
sheridancollege.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 | |||
sina.cn,imap.sina.cn,993,smtp.sina.cn,587 | |||
sina.com,imap.sina.com,993,smtp.sina.com,587 | |||
sis.hust.edu.vn,outlook.office365.com,993,smtp.office365.com,587 | |||
smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 | |||
sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 | |||
snopyta.org,mail.snopyta.org,993,mail.snopyta.org,465 | |||
sohu.com,imap.sohu.com,143,smtp.sohu.com,25 | |||
southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 | |||
spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
st.amu.edu.pl,outlook.office365.com,993,smtp.office365.com,587 | |||
stevens.edu,imap.outlook.com,993,smtp.outlook.com,587 | |||
stronzi.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
stud.feec.vutbr.cz,imap.stud.feec.vutbr.cz,993,smtp.stud.feec.vutbr.cz,587 | |||
stud.tu-darmstadt.de,imap.stud.tu-darmstadt.de,993,smtp.tu-darmstadt.de,465 | |||
stud.uis.no,outlook.office365.com,993,smtp.office365.com,587 | |||
stud.uni-bamberg.de,outlook.office365.com,993,smtp.office365.com,587 | |||
stud.uni-saarland.de,mail.hiz-saarland.de,993,mail.hiz-saarland.de,465 | |||
student.binadarma.ac.id,imap.gmail.com,993,smtp.gmail.com,587 | |||
student.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 | |||
student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 | |||
student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 | |||
student.uj.edu.pl,outlook.office365.com,993,smtp.office365.com,587 | |||
student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 | |||
studenti.unipi.it,outlook.office365.com,993,smtp.office365.com,587 | |||
studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 | |||
students.rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 | |||
students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 | |||
studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 | |||
studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 | |||
studserv.uni-leipzig.de,studserv.uni-leipzig.de,993,studserv.uni-leipzig.de,25 | |||
subvertising.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
t-online.de,secureimap.t-online.de,993,securesmtp.t-online.de,465 | |||
@@ -267,6 +277,8 @@ tecnico.ulisboa.pt,mail.tecnico.ulisboa.pt,993,mail.tecnico.ulisboa.pt,465 | |||
teknik.io,mail.teknik.io,993,mail.teknik.io,587 | |||
telenet.be,imap.telenet.be,993,smtp.telenet.be,587 | |||
tfwno.gf,mail.cock.li,993,mail.cock.li,587 | |||
thamognya.com,mail.thamognya.com,993,mail.thamognya.com,587 | |||
thunix.net,thunix.net,143,thunix.net,25 | |||
tlen.pl,poczta.o2.pl,993,poczta.o2.pl,465 | |||
tlu.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
tquad.ai,imap.mail.eu-west-1.awsapps.com,993,smtp.mail.eu-west-1.awsapps.com,465 | |||
@@ -276,23 +288,35 @@ tum.de,xmail.mwn.de,993,postout.lrz.de,587 | |||
txstate.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
ua.pt,outlook.office365.com,993,mail.ua.pt,25 | |||
uach.mx,imap.gmail.com,993,smtp.gmail.com,587 | |||
ucalgary.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587 | |||
ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
ukr.net,imap.ukr.net,993,smtp.ukr.net,465 | |||
uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 | |||
uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 | |||
uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587 | |||
uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 | |||
unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 | |||
unitn.it,imap.gmail.com,993,smtp.gmail.com,587 | |||
unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 | |||
univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 | |||
uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 | |||
uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 | |||
usa.com,imap.mail.com,993,smtp.mail.com,587 | |||
usp.br,imap.gmail.com,993,smtp.gmail.com,465 | |||
utas.edu.au,outlook.office365.com,993,smtp.office365.com,587 | |||
utdallas.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
uw.edu,imap.gmail.com,993,smtp.gmail.com,465 | |||
uwcad.it,imap.gmail.com,993,smtp.gmail.com,465 | |||
ux.uis.no,imap.ux.uis.no,993,broremann.ux.uis.no,25 | |||
uymail.com,imap.mail.com,993,smtp.mail.com,587 | |||
vip.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
vivaldi.net,imap.vivaldi.net,993,smtp.vivaldi.net,587 | |||
vp.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 | |||
vt.edu,imap.gmail.com,993,smtp.gmail.com,587 | |||
vxempire.xyz,vxempire.xyz,993,vxempire.xyz,587 | |||
vxempire.xyz,vxempire.xyz,993,vxempire.xyz,465 | |||
waifu.club,mail.cock.li,993,mail.cock.li,587 | |||
wanadoo.fr,imap.orange.fr,993,smtp.orange.fr,465 | |||
wants.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 | |||
@@ -302,16 +326,10 @@ wit.edu,outlook.office365.com,993,smtp.office365.com,587 | |||
wp.pl,imap.wp.pl,993,smtp.wp.pl,465 | |||
writeme.com,imap.mail.com,993,smtp.mail.com,587 | |||
ya.ru,imap.yandex.com,993,smtp.yandex.com,587 | |||
yahoo.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 | |||
yahoo.fr,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 | |||
yahoo.gr,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 | |||
yandex.by,imap.yandex.com,993,smtp.yandex.com,587 | |||
yandex.com,imap.yandex.com,993,smtp.yandex.com,587 | |||
yandex.kz,imap.yandex.com,993,smtp.yandex.com,587 | |||
yandex.net,imap.yandex.com,993,smtp.yandex.com,587 | |||
yandex.ru,imap.yandex.com,993,smtp.yandex.com,587 | |||
yandex.ua,imap.yandex.com,993,smtp.yandex.com,587 | |||
yahoo.*,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 | |||
yandex.*,imap.yandex.com,993,smtp.yandex.com,587 | |||
ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 | |||
zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 | |||
zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 | |||
zoho.com,imap.zoho.com,993,smtp.zoho.com,465 | |||
zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 |
@@ -1,8 +1,9 @@ | |||
text/plain; $EDITOR %s ; | |||
text/html; openfile %s ; nametemplate=%s.html | |||
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; | |||
image/*; openfile %s ; | |||
text/html; /usr/local/lib/mutt-wizard/openfile %s ; nametemplate=%s.html | |||
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; | |||
image/*; /usr/local/lib/mutt-wizard/openfile %s ; | |||
video/*; setsid mpv --quiet %s &; copiousoutput | |||
application/pdf; openfile %s ; | |||
audio/*; mpv %s ; | |||
application/pdf; /usr/local/lib/mutt-wizard/openfile %s ; | |||
application/pgp-encrypted; gpg -d '%s'; copiousoutput; | |||
application/pgp-keys; gpg --import '%s'; copiousoutput; |
@@ -3,7 +3,8 @@ | |||
# mutt-wizard will have this file sourced from your muttrc. | |||
# In the interest of seamless updating, do not edit this file. | |||
# If you want to override any settings, set those in your muttrc. | |||
set mailcap_path = /usr/local/share/mutt-wizard/mailcap | |||
set mailcap_path = $HOME/.config/mutt/mailcap:/usr/local/share/mutt-wizard/mailcap:$mailcap_path | |||
set mime_type_query_command = "file --mime-type -b %s" | |||
set date_format="%y/%m/%d %I:%M%p" | |||
set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" | |||
set sort = 'reverse-date' | |||
@@ -22,14 +23,19 @@ set forward_quote # include message in forwards | |||
set reverse_name # reply as whomever it was to | |||
set include # include message in replies | |||
set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) | |||
auto_view text/html # automatically show html (mailcap uses w3m) | |||
auto_view text/html # automatically show html (mailcap uses lynx) | |||
auto_view application/pgp-encrypted | |||
#set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. | |||
alternative_order text/plain text/enriched text/html | |||
bind index,pager i noop | |||
bind index,pager g noop | |||
bind index \Cf noop | |||
bind index,pager M noop | |||
bind index,pager C noop | |||
# General rebindings | |||
bind index gg first-entry | |||
bind index j next-entry | |||
bind index k previous-entry | |||
bind attach <return> view-mailcap | |||
@@ -51,8 +57,10 @@ bind index,query <space> tag-entry | |||
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" | |||
bind index,pager H view-raw-message | |||
bind browser l select-entry | |||
bind pager,browser gg top-page | |||
bind pager,browser G bottom-page | |||
bind browser gg top-page | |||
bind browser G bottom-page | |||
bind pager gg top | |||
bind pager G bottom | |||
bind index,pager,browser d half-down | |||
bind index,pager,browser u half-up | |||
bind index,pager S sync-mailbox | |||
@@ -63,10 +71,34 @@ bind pager \031 previous-line # Mouse wheel | |||
bind pager \005 next-line # Mouse wheel | |||
bind editor <Tab> complete-query | |||
macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox" | |||
macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox" | |||
macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox" | |||
macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts" | |||
macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts" | |||
macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts" | |||
macro index,pager gj "<change-folder>=Junk<enter>" "go to junk" | |||
macro index,pager Mj ";<save-message>=Junk<enter>" "move mail to junk" | |||
macro index,pager Cj ";<copy-message>=Junk<enter>" "copy mail to junk" | |||
macro index,pager gt "<change-folder>=Trash<enter>" "go to trash" | |||
macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash" | |||
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash" | |||
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent" | |||
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent" | |||
macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent" | |||
macro index,pager ga "<change-folder>=Archive<enter>" "go to archive" | |||
macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to archive" | |||
macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to archive" | |||
#set crypt_autosign = yes | |||
#set crypt_opportunistic_encrypt = yes | |||
#set pgp_self_encrypt = yes | |||
#set pgp_default_key = 'your@gpgemailaddre.ss' | |||
macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook" | |||
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" | |||
macro index O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail" | |||
macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern" | |||
macro index O "<shell-escape>mw -Y<enter>" "run mw -Y to sync all mail" | |||
macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern" | |||
macro index A "<limit>all\n" "show all messages (undo limit)" | |||
# Sidebar mappings | |||
@@ -75,7 +107,7 @@ set sidebar_width = 20 | |||
set sidebar_short_path = yes | |||
set sidebar_next_new_wrap = yes | |||
set mail_check_stats | |||
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' | |||
set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' | |||
bind index,pager \Ck sidebar-prev | |||
bind index,pager \Cj sidebar-next | |||
bind index,pager \Co sidebar-open | |||
@@ -131,10 +163,10 @@ color underline black default | |||
color normal default default | |||
# Regex highlighting: | |||
color header blue default ".*" | |||
color header brightmagenta default "^(From)" | |||
color header brightcyan default "^(Subject)" | |||
color header brightmagenta default "^From" | |||
color header brightcyan default "^Subject" | |||
color header brightwhite default "^(CC|BCC)" | |||
color header blue default ".*" | |||
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses | |||
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL | |||
color body green default "\`[^\`]*\`" # Green text between ` and ` | |||
@@ -0,0 +1,10 @@ | |||
# vim: filetype=neomuttrc | |||
# This is an embarrassing and hacky file that unbinds a bunch of binds between | |||
# switching accounts. It is called each time an account is changed. | |||
unset hostname | |||
unmy_hdr Organization | |||
unmailboxes * | |||
unalternates * | |||
unset signature |