# aerc-wizard
https://git.awy.one/aerc-wizard
Fork of [mutt-wizard](https://github.com/lukesmithxyz/mutt-wizard) with some additions:
- `aerc` support (no mutt-related configuration is created)
- better wayland notification handling in `mailsync`
- gmail with sane IMAP folders (for example `Sent` instead of `[Gmail]/Sent Mail`) so binds just werk
- `gopass` backend instead of `pass`
Get this great stuff without effort:
- A full-featured and autoconfigured email client on the terminal with aerc
- 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 optionally notifies you when new mail has arrived.
Specifically, this wizard:
- Determines your email server's IMAP and SMTP servers and ports
- Creates dotfiles for `aerc`, `isync`, and `msmtp` appropriate for your
email address
- Encrypts and locally stores your password for easy remote access, accessible
only by your GPG key
- Auto-creates bindings to switch between accounts or between mailboxes
- Provides sensible defaults and an attractive appearance for the aerc email
client
- If aerc-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
#### Dependencies
- `aerc` - 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.
- `gopass` - safely encrypts passwords (required at install).
- `ca-certificates` - required for SSL. Probably installed already.
- `gettext` - writes config files. Probably installed already.
```bash
git clone https://git.awy.one/aerc-wizard
cd aerc-wizard
doas make install
```
A user of Arch-based distros can also install the current aerc-wizard release from the [my arch repo](https://git.awy.one/awy-arch) as
`aerc-wizard`, or build from git master branch using this [PKGBUILD](https://git.awy.one/archpackaging/file/aerc-wizard/PKGBUILD.html).
### Optional Dependencies
- `goimapnotify` - required for push notifications.
[Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
- `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).
- `w3m` - view HTML email in aerc.
- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell
it that your mail is in `~/.local/share/mail/` (although `aew` 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.
- `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.
## Usage
The aerc-wizard runs via the command `aew`. Once setup is complete, you'll use
`aerc` to access your mail.
- `aew -a you@email.com` -- add a new email account
- `aew -l` -- list existing accounts
- `aew -d` -- choose an account to delete
- `aew -D your@email.com` -- delete account settings without confirmation
- `aew -t 30` -- toggle automatic mailsync to every 30 minutes
- `aew -T` -- toggle mailsync without specifying minutes (default is 10)
- `aew -r` -- reorder account shortcut numbers
- `gopass edit aew-your@email.com` -- revise an account's password
- `mailsync` -- sync all configured email accounts. Also gives notifications of new mail and indexes new mail with notmuch silently.
- `mailsync your@email.com` -- sync a particular (or several) email account(s).
### 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).
- `mailsync` gives visual messages of new mail by default. Or, set
`MAILSYNC_MUTE=1` as an environmental variable if you prefer not having them.
## Aerc 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: sent, inbox, archive, drafts, Spam, etc.
- M and C - For Move and Copy: 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 aerc-wizard, they will each be assigned a number.
- a to add address/person to abook and Tab while typing address to complete
one from abook.
- ? - see all keyboard shortcuts
- ctrl-j/ctrl-k - move up and down in sidebar.
- ctrl-b - open a menu to select a URL you want to open in your browser.
- p - encrypt/sign your message (in compose view, before sending the email).
## Enable push notifications per mail
**Note**: Replace the `fulladdrs` with your actual email address. You have to do this for each new mail you want to setup instant notifications.
```bash
systemctl enable --user goimapnotify@fulladdrs.service
```
## 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 aerc.
- `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it
that your mail is in `~/.local/share/mail/` (although `aew` 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.
- `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.
## Help the Project!
- Try aerc-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 aerc-wizard.
## 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.
To create an App Password for your Google account,
you can directly visit the [App Passwords](https://myaccount.google.com/apppasswords) page in your Google Account 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). `aew` 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
aerc-wizard is free/libre software. This program is released under the GPLv3
license, which you can find in the file [LICENSE](LICENSE).