@@ -3,4 +3,4 @@ personal.muttrc | |||
*.gpg | |||
*.pyc | |||
accounts/ | |||
*mailsynclastrun | |||
*mw.lastrun |
@@ -1,159 +0,0 @@ | |||
# mutt-wizard | |||
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 away from internet and keep backups | |||
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 stores locally 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. | |||
## Install and Use | |||
``` | |||
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/). | |||
*NOTE:* If you have used an older version of mutt-wizard, especially when it used to use `offlineimap`, you need to remove your old configs. | |||
Back up what's important and run: | |||
``` | |||
rm -rf ~/.config/mutt ~/.msmtprc ~/.config/msmtp ~/.offlineimap ~/.offlineimaprc ~/.config/offlineimap ~/.mbsyncrc | |||
``` | |||
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. | |||
- `mw add` -- add a new email account | |||
- `mw ls` -- list existing accounts | |||
- `mw pass` -- revise an account's password | |||
- `mw delete` -- deleted an added account | |||
- `mw purge` -- delete all accounts and settings | |||
- `mw cron` -- toggle/configure a cronjob to sync mail | |||
## 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) | |||
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`. | |||
### Optional | |||
- `w3m` - view HTML email and images in neomutt. | |||
- `notmuch` - index and search mail. | |||
Install it and run `notmuch setup`. | |||
Tell it where your mail is (`$MAILDIR` or `~/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 out the repo and directions [here](https://github.com/cruegge/pam-gnupg). | |||
- `urlview` - outputs urls in mail to browser. | |||
## 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` | |||
- `D` - delete mail | |||
- `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 (needs urlview). | |||
- `gm / gM` - call mutt-wizard's mailsync for one / all mail accounts | |||
## New stuff and improvements since the original release | |||
- honors `$MAILDIR`, `$XDG_CONFIG_HOME`, `$XDG_CACHE_HOME`, if defined. | |||
- `gm/gM` to sync mail inside `mutt`, as `o/O` has a `mutt` assignment already. | |||
- Make channel name equal to email address to avoid choosing a new name for the same thing. | |||
- `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. | |||
- 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 `~/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. | |||
- Addition of a manual `man mw`. | |||
## 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. | |||
## Details for Tinkerers | |||
- The critical `mutt`/`neomutt` files are in `~/.config/mutt/` (or `$XDG_CONFIG_HOME/mutt`) | |||
- Put whatever global settings you want into `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. | |||
To avoid insertion of the line sourcing the default settings, | |||
have a commented `# source /usr/share/mutt-wizard/mutt-wizard.muttrc` in your muttrc. | |||
## Watch out for these things: | |||
- For Gmail accounts, remember also to enable third-party ("""less secure""") applications before attempting installation. | |||
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. | |||
- 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 should work for Mac OS 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) | |||
- Option to keep configuration for accounts that failed to connect (maybe) |
@@ -0,0 +1,327 @@ | |||
========================================= | |||
mw(1) Version 2.0 \| mutt-wizard man page | |||
========================================= | |||
.. To test man page: | |||
.. | |||
.. pandoc README.rst -s -t man | /usr/bin/man -l - | |||
.. | |||
.. The generate: | |||
.. | |||
.. pandoc README.rst -s -t man -o mw.1 | |||
NAME | |||
==== | |||
**mw** — mutt-wizard - add, list, remove email configurations for mbsync, getmail and mutt. Sync email without mutt. | |||
SYNOPSIS | |||
======== | |||
**mw** [<command>|<email>] | |||
| **mw** Same as *mw sync* | |||
| **mw add** Add and configure an email address (9 max.) | |||
| **mw list** List configured accounts | |||
| **mw remove** Pick an account to remove | |||
| **mw purge** Remove all accounts and settings | |||
| **mw cron** Enable or disable an autosync via cronjob | |||
| **mw sync** Sync mail based on config in *.config/isync/mbsyncrc* and *.config/getmail/\** | |||
| **mw –help\|-h** Print this message | |||
| **mw –version\|-v** Print version | |||
DESCRIPTION | |||
=========== | |||
**mw** configures **mbsync**, **getmail**, **msmtp** and **mutt** in one go. | |||
**mutt** stands for **mutt** or **neomutt**. | |||
**mw** asks the user for the information it needs. | |||
They cannot be provided as parameters to the command. | |||
It is still possible to script **mw** by defining variables. | |||
See the commands section. | |||
*mutt-wizard.muttrc* is linked in your *muttrc*. | |||
Have this line there, if you prefer your own settings:: | |||
# source /usr/share/mutt-wizard/mutt-wizard.muttrc | |||
You will need to keep the binding of *i,g,C,M* to *noop*, though, | |||
because of the generated bindings in the account muttrc. | |||
COMMANDS | |||
======== | |||
Without command parameter **sync** is assumed. | |||
If the parameter contains @ an email is assumed and synced. | |||
*add* | |||
Add new email | |||
First you decide, whether you want to configure | |||
- **mbsync**, **getmail**, **msmtp** to sync emails independently from **mutt** using **mw**, | |||
- or just **mutt**. | |||
For an IMAP server **mutt** becomes very slow. | |||
So normally you enter **yes** here. | |||
**mw** asks you the **email address**. | |||
**mw** has a **database** of IMAP4/POP3 and SMTP servers and ports. | |||
If you are lucky, your email server is there. | |||
Else **mw** will prompt you. | |||
Add an email without questions, e.g.:: | |||
a=x.y@gmail.com mwtype=offline mwaddr=$a mwlogin=$a mwpass=mutt-wizard-$a mwserverinfo="gmail.com,imap.gmail.com,993,smtp.gmail.com,587" mwname="your name" mw add | |||
*mwserverinfo* can be omitted, if the email domain is in the accompanied *domains.csv*. | |||
*ls|list* | |||
List all email accounts configured by mutt-wizard | |||
*rm|remove* | |||
Remove the configuration files for an already configured email | |||
Remove without questions the email whose generated muttrc starts with 1:: | |||
mwpick=1 mw rm <<<y | |||
*purge* | |||
Removes all mw generated mutt settings and | |||
| *.config/mutt/accounts/1-\** | |||
| *.config/isync/mbsyncrc* | |||
| *.config/getmail/\** | |||
| *.config/msmtp/config* | |||
Files are under *.config* or *$XDG_CONFIG_HOME* | |||
If you don't want questions:: | |||
mw purge <<<y | |||
*cron* | |||
Toggle a cronjob that periodically syncs mail | |||
Without questions:: | |||
mwcronremove=yes mw cron | |||
mwcronminutes=99 mw cron | |||
*sync* | |||
Syncs mail for all email accounts managed by **mw** (whose paths end in the email). | |||
This is the default, if no parameter is given. | |||
If an email address is given, only that email is synced. | |||
Every **mw** sync run will re-generate the **mutt** configuration | |||
from the configuration files for **mbsync**, **getmail** and **msmtp**. | |||
So you could edit them after or not use *mw add* at all. | |||
Just keep the *Path*, *path* and *account* ending in the email address. | |||
DEPENDENCIES | |||
============ | |||
Required for email setup or operation: | |||
- *pass* - `pass <https://www.passwordstore.org/>`__ safely encrypts passwords | |||
- *gnupg* - needed by *pass* | |||
- *mutt/neomutt* - the email client (*mutt* untested). | |||
- *isync’s mbsync* - syncs the mail | |||
- *getmail* - used for POP3 | |||
- *msmtp* - sends the email | |||
Optional: | |||
- *w3m* - view HTML email and images in **mutt**. | |||
- *notmuch* - index and search mail. | |||
If the configuration file *$NOTMUCH_CONFIG* is not there, | |||
*mw add* will create it. | |||
- *libnotify* - allows notifications when syncing mail with **mw** | |||
- *abook* - a terminal-based address book. | |||
- A cron manager (e.g. *cronie*) - if you want to enable the auto-sync | |||
feature. | |||
- *pam-gnupg* - To provide your GPG key at login and never after. | |||
See `directions <https://github.com/cruegge/pam-gnupg>`__. | |||
Alternatively avoid constant password requests by increasing | |||
- *default-cache-ttl* and *max-cache-ttl* in *gpg-agent.conf* | |||
- *urlscan* - outputs urls in mail | |||
INSTALLATION | |||
============ | |||
:: | |||
git clone https://github.com/rpuntaie/mutt-wizard | |||
cd mutt-wizard | |||
sudo make install | |||
MUTT CONFIGURATION | |||
================== | |||
Once everything is setup, you’ll use **mutt** to access your mail. | |||
The accompanied *mutt-wizard.muttrc* modifies some **mutt** defaults. | |||
Look there for a complete list. | |||
Here an overview: | |||
- *?* - see all keyboard shortcuts | |||
**syncing** | |||
- *gm / gM* - call mutt-wizard’s *mw sync* for one / all mail accounts | |||
**mailboxes,accounts** | |||
- *ixy* - To go to **mailbox**. | |||
- *Mxy*, *Cxy* - For Move and Copy to the according mailbox, | |||
e.g. *Msp* means "move to Spam". | |||
- *i[1-9]* - go to another **account**. | |||
*xy* are | |||
- the two first letters of a mailbox or | |||
- first letter of first + second letter of second path entry | |||
**searching** | |||
- *S* - search for a mail using *notmuch* | |||
- *gl* - limit by substring of subject | |||
- *gL* - undo limit | |||
**composing** | |||
- *ga* - to add address/person to *abook* and *Tab* while typing | |||
address to complete one from book. | |||
- *m/r/gr/f* - new/reply/group reply/forward **message**, | |||
using your default *$EDITOR* to write. | |||
Then you enter the **compose screen**. | |||
- *a* - to add attachments | |||
- *s/t/c/b/d* - to change the subject/to/CC/BCC/description. | |||
- *S* - to change the signature/encryption | |||
- *y* - to send the mail. | |||
**delete,undelete,save** | |||
- *dd* - delete mail | |||
- *u* - undelete | |||
- *$* - apply the mailbox changes *set trash* is set per default. | |||
Deleted mails will land there. | |||
- *s* - save selected mail or selected attachment | |||
**moving around** | |||
- *gu* - open a menu to select a url you want to open in you browser | |||
(needs urlscan). | |||
- *j*/*k* - next/previous mail, *J/K* same, without skipping deleted, | |||
and also when viewing mails | |||
- *ctrl-d/f*/*ctrl-u/b* - down and up a half page / full page | |||
- *l* - open mail, or attachment page or attachment | |||
- *h* - the opposite of *l* | |||
**sidebar** | |||
- *B* - toggles | |||
- *ctrl-j*/*ctrl-k* - move up and down | |||
- *ctrl-l/o* - opens mailbox | |||
**input field/command line** | |||
- *ctrl-u* clears the line | |||
- *ctrl-a*, *ctrl-e* go to beginning or end | |||
- *ctrl-g* aborts | |||
DETAILS | |||
======= | |||
**Encoding/Language** | |||
*isync* is not fully UTF-8 compatible. | |||
**mw** assumes english mailbox names. | |||
Set your email language to English on your mail server. | |||
**Mail location** | |||
Mail is downloaded to a folders named after your emails in *$MAILDIR*. | |||
*$MAILDIR* defaults to *$HOME/Mail/*. | |||
Neither **mw remove** nor **mw purge** will delete downloaded mail. | |||
**Gmail accounts** | |||
For Gmail allow "less-secure" applications: | |||
<https://support.google.com/accounts/answer/6010255>. | |||
Do this before running mutt-wizard. | |||
**Protonmail accounts** | |||
Protonmail users must use the Protonmail Bridge | |||
<https://protonmail.com/bridge/> | |||
to access their IMAP and SMTP servers. | |||
Do this before running mutt-wizard. | |||
FILES | |||
===== | |||
*/user/bin/mw* | |||
The main script to manage and sync emails. | |||
*/user/bin/mwimage*, */user/bin/mwopen* | |||
Used by the mailcap file that comes with mutt-wizard. | |||
*/usr/share/mutt-wizard/mutt-wizard.muttrc* | |||
Default mutt settings. | |||
*/usr/share/mutt-wizard/mailcap* | |||
Default mailcap file. | |||
*/usr/share/mutt-wizard/domains.csv* | |||
Email server database. | |||
BUGS | |||
==== | |||
GitHub Issues: <https://github.com/rpuntaie/mutt-wizard/issues> | |||
AUTHORS | |||
======= | |||
*Luke Smith* <luke@lukesmith.xyz> | |||
Original author, started in 2018. | |||
Github <https://github.com/lukesmithxyz/mutt-wizard> | |||
Gitlab <https://gitlab.com/lukesmithxyz/mutt-wizard> | |||
*Roland Puntaier* <roland.puntaier@gmail.com> | |||
Bugfixes, Improvements in 2019. | |||
GitHub: <https://github.com/rpuntaie/mutt-wizard> | |||
LICENSE | |||
======= | |||
GPLv3 | |||
SEE ALSO | |||
======== | |||
**neomutt**\ (1), **neomuttrc**\ (1) **mbsync**\ (1), **msmtp**\ (1), | |||
**notmuch**\ (1), **abook**\ (1) |
@@ -1,82 +0,0 @@ | |||
#!/usr/bin/env sh | |||
# Sync mail and give notification if there is new mail. | |||
case "$(uname)" in | |||
Linux) prefix="/usr" ;; | |||
*) prefix="/usr/local" ;; | |||
esac | |||
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus | |||
export DISPLAY=:0.0 | |||
if [[ -z $PASSWORD_STORE_DIR ]]; then | |||
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" | |||
fi | |||
configdir=${XDG_CONFIG_HOME:-$HOME/.config} | |||
maildir="${MAILDIR:-$HOME/Mail}" | |||
lastrun=${XDG_CACHE_HOME:-$HOME/.cache}/.mailsynclastrun | |||
if [[ -f $configdir/isync/mbsyncrc ]]; then | |||
mbsyncrc="$configdir/isync/mbsyncrc" | |||
else | |||
mbsyncrc="$HOME/.mbsyncrc" | |||
fi | |||
mbsyncbin="$prefix/bin/mbsync -c $mbsyncrc" | |||
# Run only if user logged in (prevent cron errors) | |||
pgrep -u "$USER" >/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 ;} | |||
# Checks for internet connection and set notification script. | |||
ping -q -c 1 1.1.1.1 > /dev/null || { 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." | |||
# 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 ;} | |||
else | |||
notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | |||
fi | |||
# Check account for new mail. Notify if there is new content. | |||
syncandnotify() { | |||
acc="$(echo "$account" | sed "s/.*\///")" | |||
$mbsyncbin "$acc" | |||
new=$(find "$maildir/$acc/INBOX/new/" "$maildir/$acc/Inbox/new/" "$maildir/$acc/inbox/new/" -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') | |||
notify-send "📧$from:" "$subject" & | |||
done | |||
fi | |||
} | |||
# Sync accounts passed as argument or all. | |||
if [ "$#" -eq "0" ]; then | |||
accounts="$(awk '/^Group .*@.*/ {print $2}' "$mbsyncrc")" | |||
accounts+=" $(awk '/^Channel .*@.*/ {print $2}' "$mbsyncrc")" | |||
else | |||
accounts=$* | |||
fi | |||
echo " 🔃" > /tmp/imapsyncicon_"$USER" | |||
pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | |||
# Parallelize multiple accounts | |||
for account in $accounts | |||
do | |||
syncandnotify & | |||
done | |||
wait | |||
rm -f /tmp/imapsyncicon_"$USER" | |||
pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | |||
notmuch new 2>/dev/null | |||
#Create a touch file that indicates the time of the last run of mailsync | |||
touch "$lastrun" |
@@ -0,0 +1,52 @@ | |||
History (newest first) | |||
Generate man page from readme, to avoid duplicate descriptions. | |||
Readme in rst instead of md. | |||
Separate changelog.txt. | |||
Add tests and made bug fixes | |||
*urlscan* instead of *urlview* | |||
*wm* generates *mutt* config on every full sync, | |||
- to reflect changes in mailboxes in the shortcuts | |||
- to reflect changes in *mbsync/getmail* config in *mutt* config | |||
*wm* integrates *mailsync*, | |||
not to overload the system namespace and because of code reuse | |||
*remove|rm* instead of *delete*, *list|ls* instead of only *ls* | |||
Make channel name equal to email address | |||
to avoid choosing a new name for the same thing. | |||
Other more vim-like shortcut changes | |||
*gm/gM* to sync mail inside *mutt*, as *o/O* has a *mutt* assignment already. | |||
Honor *$MAILDIR*, *$XDG_CONFIG_HOME*, *$XDG_CACHE_HOME*, if defined. | |||
`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 (less 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. | |||
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 `~/Mail`, reducing mess in `~`. | |||
`pass` is used as a password manager instead of separately saving passwords. | |||
Script is POSIX sh compliant. | |||
Addition of a manual `man mw`. |
@@ -1,242 +1,424 @@ | |||
.TH MW 1 mutt-wizard | |||
.\" Automatically generated by Pandoc 2.7.3 | |||
.\" | |||
.TH "mw" "1" "" "Version 2.0" "mutt-wizard man page" | |||
.hy | |||
.SH NAME | |||
mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync | |||
.PP | |||
\f[B]mw\f[R] \[em] mutt-wizard - add, list, remove email configurations | |||
for mbsync, getmail and mutt. | |||
Sync email without mutt. | |||
.SH SYNOPSIS | |||
.B mw | |||
<command> | |||
.PP | |||
\f[B]mw\f[R] [<command>|<email>] | |||
.PP | |||
\f[B]mw\f[R] Same as \f[I]mw sync\f[R] | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw add\f[R] Add and configure an email address (9 max.) | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw list\f[R] List configured accounts | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw remove\f[R] Pick an account to remove | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw purge\f[R] Remove all accounts and settings | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw cron\f[R] Enable or disable an autosync via cronjob | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw sync\f[R] Sync mail based on config in | |||
\f[I].config/isync/mbsyncrc\f[R] and \f[I].config/getmail/*\f[R] | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw \[en]help|-h\f[R] Print this message | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[B]mw \[en]version|-v\f[R] Print version | |||
.SH DESCRIPTION | |||
.B mw | |||
takes a user email account and sets up a terminal-based email interface with it for | |||
.B neomutt. | |||
This can include offline email with | |||
.B isync/mbsync | |||
and configs for | |||
.B msmtp | |||
for sending mail, and passwords automatically encrypted and stored with | |||
.B pass. | |||
.PP | |||
\f[B]mw\f[R] configures \f[B]mbsync\f[R], \f[B]getmail\f[R], | |||
\f[B]msmtp\f[R] and \f[B]mutt\f[R] in one go. | |||
\f[B]mutt\f[R] stands for \f[B]mutt\f[R] or \f[B]neomutt\f[R]. | |||
.PP | |||
\f[B]mw\f[R] asks the user for the information it needs. | |||
They cannot be provided as parameters to the command. | |||
It is still possible to script \f[B]mw\f[R] by defining variables. | |||
See the commands section. | |||
.PP | |||
\f[I]mutt-wizard.muttrc\f[R] is linked in your \f[I]muttrc\f[R]. | |||
Have this line there, if you prefer your own settings: | |||
.IP | |||
.nf | |||
\f[C] | |||
# source /usr/share/mutt-wizard/mutt-wizard.muttrc | |||
\f[R] | |||
.fi | |||
.PP | |||
You will need to keep the binding of \f[I]i,g,C,M\f[R] to | |||
\f[I]noop\f[R], though, because of the generated bindings in the account | |||
muttrc. | |||
.SH COMMANDS | |||
.TP | |||
.B add | |||
configure an email account | |||
.TP | |||
.B ls | |||
list all email accounts configured by mutt-wizard | |||
.TP | |||
.B delete | |||
delete the configuration files for an already configured email account | |||
.TP | |||
.B purge | |||
totally purge all local mutt-wizard/mbync/msmtp settings | |||
.TP | |||
.B cron | |||
toggle a cronjob that will automatically sync mail with | |||
.B mailsync | |||
as often as you wish | |||
.PP | |||
Without command parameter \f[B]sync\f[R] is assumed. | |||
If the parameter contains \[at] an email is assumed and synced. | |||
.PP | |||
\f[I]add\f[R] | |||
.RS | |||
.PP | |||
Add new email | |||
.PP | |||
First you decide, whether you want to configure | |||
.IP \[bu] 2 | |||
\f[B]mbsync\f[R], \f[B]getmail\f[R], \f[B]msmtp\f[R] to sync emails | |||
independently from \f[B]mutt\f[R] using \f[B]mw\f[R], | |||
.IP \[bu] 2 | |||
or just \f[B]mutt\f[R]. | |||
For an IMAP server \f[B]mutt\f[R] becomes very slow. | |||
So normally you enter \f[B]yes\f[R] here. | |||
.PP | |||
\f[B]mw\f[R] asks you the \f[B]email address\f[R]. | |||
.PP | |||
\f[B]mw\f[R] has a \f[B]database\f[R] of IMAP4/POP3 and SMTP servers and | |||
ports. | |||
If you are lucky, your email server is there. | |||
Else \f[B]mw\f[R] will prompt you. | |||
.PP | |||
Add an email without questions, e.g.: | |||
.IP | |||
.nf | |||
\f[C] | |||
a=x.y\[at]gmail.com mwtype=offline mwaddr=$a mwlogin=$a mwpass=mutt-wizard-$a mwserverinfo=\[dq]gmail.com,imap.gmail.com,993,smtp.gmail.com,587\[dq] mwname=\[dq]your name\[dq] mw add | |||
\f[R] | |||
.fi | |||
.PP | |||
\f[I]mwserverinfo\f[R] can be omitted, if the email domain is in the | |||
accompanied \f[I]domains.csv\f[R]. | |||
.RE | |||
.PP | |||
\f[I]ls|list\f[R] | |||
.RS | |||
.PP | |||
List all email accounts configured by mutt-wizard | |||
.RE | |||
.PP | |||
\f[I]rm|remove\f[R] | |||
.RS | |||
.PP | |||
Remove the configuration files for an already configured email | |||
.PP | |||
Remove without questions the email whose generated muttrc starts with 1: | |||
.IP | |||
.nf | |||
\f[C] | |||
mwpick=1 mw rm <<<y | |||
\f[R] | |||
.fi | |||
.RE | |||
.PP | |||
\f[I]purge\f[R] | |||
.RS | |||
.PP | |||
Removes all mw generated mutt settings and | |||
.PP | |||
\f[I].config/mutt/accounts/1-*\f[R] | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[I].config/isync/mbsyncrc\f[R] | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[I].config/getmail/*\f[R] | |||
.PD 0 | |||
.P | |||
.PD | |||
\f[I].config/msmtp/config\f[R] | |||
.PP | |||
Files are under \f[I].config\f[R] or \f[I]$XDG_CONFIG_HOME\f[R] | |||
.PP | |||
If you don\[aq]t want questions: | |||
.IP | |||
.nf | |||
\f[C] | |||
mw purge <<<y | |||
\f[R] | |||
.fi | |||
.RE | |||
.PP | |||
\f[I]cron\f[R] | |||
.RS | |||
.PP | |||
Toggle a cronjob that periodically syncs mail | |||
.PP | |||
Without questions: | |||
.IP | |||
.nf | |||
\f[C] | |||
mwcronremove=yes mw cron | |||
mwcronminutes=99 mw cron | |||
\f[R] | |||
.fi | |||
.RE | |||
.PP | |||
\f[I]sync\f[R] | |||
.RS | |||
.PP | |||
Syncs mail for all email accounts managed by \f[B]mw\f[R] (whose paths | |||
end in the email). | |||
.PP | |||
This is the default, if no parameter is given. | |||
If an email address is given, only that email is synced. | |||
.PP | |||
Every \f[B]mw\f[R] sync run will re-generate the \f[B]mutt\f[R] | |||
configuration from the configuration files for \f[B]mbsync\f[R], | |||
\f[B]getmail\f[R] and \f[B]msmtp\f[R]. | |||
So you could edit them after or not use \f[I]mw add\f[R] at all. | |||
.PP | |||
Just keep the \f[I]Path\f[R], \f[I]path\f[R] and \f[I]account\f[R] | |||
ending in the email address. | |||
.RE | |||
.SH DEPENDENCIES | |||
.PP | |||
Required for email setup or operation: | |||
.IP \[bu] 2 | |||
\f[I]pass\f[R] - pass (https://www.passwordstore.org/) safely encrypts | |||
passwords | |||
.IP \[bu] 2 | |||
\f[I]gnupg\f[R] - needed by \f[I]pass\f[R] | |||
.IP \[bu] 2 | |||
\f[I]mutt/neomutt\f[R] - the email client (\f[I]mutt\f[R] untested). | |||
.IP \[bu] 2 | |||
\f[I]isync\[cq]s mbsync\f[R] - syncs the mail | |||
.IP \[bu] 2 | |||
\f[I]getmail\f[R] - used for POP3 | |||
.IP \[bu] 2 | |||
\f[I]msmtp\f[R] - sends the email | |||
.PP | |||
Optional: | |||
.IP \[bu] 2 | |||
\f[I]w3m\f[R] - view HTML email and images in \f[B]mutt\f[R]. | |||
.IP \[bu] 2 | |||
\f[I]notmuch\f[R] - index and search mail. | |||
If the configuration file \f[I]$NOTMUCH_CONFIG\f[R] is not there, | |||
\f[I]mw add\f[R] will create it. | |||
.IP \[bu] 2 | |||
\f[I]libnotify\f[R] - allows notifications when syncing mail with | |||
\f[B]mw\f[R] | |||
.IP \[bu] 2 | |||
\f[I]abook\f[R] - a terminal-based address book. | |||
.IP \[bu] 2 | |||
A cron manager (e.g.\ *cronie*) - if you want to enable the auto-sync | |||
feature. | |||
.IP \[bu] 2 | |||
\f[I]pam-gnupg\f[R] - To provide your GPG key at login and never after. | |||
See directions (https://github.com/cruegge/pam-gnupg). | |||
.RS 2 | |||
.PP | |||
Alternatively avoid constant password requests by increasing | |||
.IP \[bu] 2 | |||
\f[I]default-cache-ttl\f[R] and \f[I]max-cache-ttl\f[R] in | |||
\f[I]gpg-agent.conf\f[R] | |||
.RE | |||
.IP \[bu] 2 | |||
\f[I]urlscan\f[R] - outputs urls in mail | |||
.SH INSTALLATION | |||
.IP | |||
.nf | |||
\f[C] | |||
git clone https://github.com/rpuntaie/mutt-wizard | |||
cd mutt-wizard | |||
sudo make install | |||
\f[R] | |||
.fi | |||
.SH MUTT CONFIGURATION | |||
.PP | |||
Once everything is setup, you\[cq]ll use \f[B]mutt\f[R] to access your | |||
mail. | |||
.PP | |||
The accompanied \f[I]mutt-wizard.muttrc\f[R] modifies some | |||
\f[B]mutt\f[R] defaults. | |||
Look there for a complete list. | |||
.PP | |||
Here an overview: | |||
.IP \[bu] 2 | |||
\f[I]?\f[R] - see all keyboard shortcuts | |||
.PP | |||
\f[B]syncing\f[R] | |||
.IP \[bu] 2 | |||
\f[I]gm / gM\f[R] - call mutt-wizard\[cq]s \f[I]mw sync\f[R] for one / | |||
all mail accounts | |||
.PP | |||
\f[B]mailboxes,accounts\f[R] | |||
.IP \[bu] 2 | |||
\f[I]ixy\f[R] - To go to \f[B]mailbox\f[R]. | |||
.IP \[bu] 2 | |||
\f[I]Mxy\f[R], \f[I]Cxy\f[R] - For Move and Copy to the according | |||
mailbox, e.g.\ *Msp* means \[dq]move to Spam\[dq]. | |||
.IP \[bu] 2 | |||
\f[I]i[1-9]\f[R] - go to another \f[B]account\f[R]. | |||
.RS 2 | |||
.PP | |||
\f[I]xy\f[R] are | |||
.IP \[bu] 2 | |||
the two first letters of a mailbox or | |||
.IP \[bu] 2 | |||
first letter of first + second letter of second path entry | |||
.RE | |||
.PP | |||
\f[B]searching\f[R] | |||
.IP \[bu] 2 | |||
\f[I]S\f[R] - search for a mail using \f[I]notmuch\f[R] | |||
.IP \[bu] 2 | |||
\f[I]gl\f[R] - limit by substring of subject | |||
.IP \[bu] 2 | |||
\f[I]gL\f[R] - undo limit | |||
.PP | |||
\f[B]composing\f[R] | |||
.IP \[bu] 2 | |||
\f[I]ga\f[R] - to add address/person to \f[I]abook\f[R] and | |||
\f[I]Tab\f[R] while typing address to complete one from book. | |||
.IP \[bu] 2 | |||
\f[I]m/r/gr/f\f[R] - new/reply/group reply/forward \f[B]message\f[R], | |||
using your default \f[I]$EDITOR\f[R] to write. | |||
Then you enter the \f[B]compose screen\f[R]. | |||
.IP \[bu] 2 | |||
\f[I]a\f[R] - to add attachments | |||
.IP \[bu] 2 | |||
\f[I]s/t/c/b/d\f[R] - to change the subject/to/CC/BCC/description. | |||
.IP \[bu] 2 | |||
\f[I]S\f[R] - to change the signature/encryption | |||
.IP \[bu] 2 | |||
\f[I]y\f[R] - to send the mail. | |||
.PP | |||
\f[B]delete,undelete,save\f[R] | |||
.IP \[bu] 2 | |||
\f[I]dd\f[R] - delete mail | |||
.IP \[bu] 2 | |||
\f[I]u\f[R] - undelete | |||
.IP \[bu] 2 | |||
\f[I]$\f[R] - apply the mailbox changes \f[I]set trash\f[R] is set per | |||
default. | |||
Deleted mails will land there. | |||
.IP \[bu] 2 | |||
\f[I]s\f[R] - save selected mail or selected attachment | |||
.PP | |||
\f[B]moving around\f[R] | |||
.IP \[bu] 2 | |||
\f[I]gu\f[R] - open a menu to select a url you want to open in you | |||
browser (needs urlscan). | |||
.IP \[bu] 2 | |||
\f[I]j\f[R]/\f[I]k\f[R] - next/previous mail, \f[I]J/K\f[R] same, | |||
without skipping deleted, and also when viewing mails | |||
.IP \[bu] 2 | |||
\f[I]ctrl-d/f\f[R]/\f[I]ctrl-u/b\f[R] - down and up a half page / full | |||
page | |||
.IP \[bu] 2 | |||
\f[I]l\f[R] - open mail, or attachment page or attachment | |||
.IP \[bu] 2 | |||
\f[I]h\f[R] - the opposite of \f[I]l\f[R] | |||
.PP | |||
\f[B]sidebar\f[R] | |||
.IP \[bu] 2 | |||
\f[I]B\f[R] - toggles | |||
.IP \[bu] 2 | |||
\f[I]ctrl-j\f[R]/\f[I]ctrl-k\f[R] - move up and down | |||
.IP \[bu] 2 | |||
\f[I]ctrl-l/o\f[R] - opens mailbox | |||
.PP | |||
\f[B]input field/command line\f[R] | |||
.IP \[bu] 2 | |||
\f[I]ctrl-u\f[R] clears the line | |||
.IP \[bu] 2 | |||
\f[I]ctrl-a\f[R], \f[I]ctrl-e\f[R] go to beginning or end | |||
.IP \[bu] 2 | |||
\f[I]ctrl-g\f[R] aborts | |||
.SH DETAILS | |||
.PP | |||
\f[B]Encoding/Language\f[R] | |||
.RS | |||
.PP | |||
\f[I]isync\f[R] is not fully UTF-8 compatible. | |||
\f[B]mw\f[R] assumes english mailbox names. | |||
Set your email language to English on your mail server. | |||
.RE | |||
.PP | |||
\f[B]Mail location\f[R] | |||
.RS | |||
.PP | |||
Mail is downloaded to a folders named after your emails in | |||
\f[I]$MAILDIR\f[R]. | |||
\f[I]$MAILDIR\f[R] defaults to \f[I]$HOME/Mail/\f[R]. | |||
Neither \f[B]mw remove\f[R] nor \f[B]mw purge\f[R] will delete | |||
downloaded mail. | |||
.RE | |||
.PP | |||
\f[B]Gmail accounts\f[R] | |||
.RS | |||
.PP | |||
For Gmail allow \[dq]less-secure\[dq] applications: | |||
<<https://support.google.com/accounts/answer/6010255>>. | |||
Do this before running mutt-wizard. | |||
.RE | |||
.PP | |||
\f[B]Protonmail accounts\f[R] | |||
.RS | |||
.PP | |||
Protonmail users must use the Protonmail Bridge | |||
<<https://protonmail.com/bridge/>> to access their IMAP and SMTP | |||
servers. | |||
Do this before running mutt-wizard. | |||
.RE | |||
.SH FILES | |||
.TP | |||
.B Mail location | |||
If the user chooses to keep offline email with | |||
.B isync, | |||
it will be kept in | |||
.I $MAILDIR | |||
which defaults to | |||
.I $HOME/mail/. | |||
.B notmuch | |||
can be used to index and search this mail by giving this directory when first running | |||
.B notmuch setup. | |||
If you have not set up notmuch before, mutt-wizard will automatically set it up in the background the first time you add an account. | |||
.TP | |||
.B muttrc files | |||
mutt-wizard will create a muttrc file for each created account holding account-specific details. These will appear in | |||
.I $XDG_CONFIG_HOME/mutt/accounts/. | |||
$XGD_CONFIG_HOME default to ~/.config. | |||
Note that mutt-wizard will also source these files and create the bindings to switch between them, and these will appear in your default | |||
.I $XDG_CONFIG_HOME/mutt/muttrc | |||
file. | |||
.TP | |||
.B Mail deletion | |||
Neither | |||
.B delete | |||
or | |||
.B purge | |||
will delete downloaded mail for 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 | |||
mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in | |||
.I /usr/share/mutt-wizard/mutt-wizard.muttrc | |||
and the default mailcap file can be found in | |||
.I | |||
/usr/share/mutt-wizard/mailcap. | |||
Any of these settings can be overwritten in | |||
.I $XDG_CONFIG_HOME/mutt/muttrc, | |||
but be mindful that your overriding binds should appear after the | |||
.I | |||
mutt-wizard.muttrc | |||
file is sourced. | |||
.TP | |||
.B Detecting server settings | |||
mutt-wizard has a repository of email services and their server information kept in | |||
.I /usr/share/mutt-wizard/domains.csv | |||
which is used to automatically configure email settings. | |||
If your email provider is not found there, it will prompt you to input your email service's IMAP and SMTP server information which can usually be found by searching online. | |||
If you would like to help develop mutt-wizard for others, you are invited to add this service information to | |||
.I domains.csv | |||
on mutt-wizard's Github <https://github.com/lukesmithxyz/mutt-wizard> or Gitlab <https://gitlab.com/lukesmithxyz/mutt-wizard> pages. | |||
.B \f[I]/user/bin/mw\f[R] | |||
The main script to manage and sync emails. | |||
.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. | |||
.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. | |||
.B \f[I]/user/bin/mwimage\f[R], \f[I]/user/bin/mwopen\f[R] | |||
Used by the mailcap file that comes with mutt-wizard. | |||
.TP | |||
.B Password decryption | |||
mutt-wizard uses | |||
.I pass | |||
and therefore | |||
.I gpg | |||
to decrypt your passwords. | |||
Provided your GPG key has a password, this might mean that you will be prompted for your GPG password the first time you sync or send mail in a session. | |||
Once your password is cached, it might also expire later as well. | |||
Because of this I strongly recommend the program | |||
.I pam-gnupg | |||
<https://github.com/cruegge/pam-gnupg> which automatically unlocks your GPG password on login and keeps it active. | |||
This gives you secure access to all your email accounts on your system without ever having to input a password. | |||
If you don't want to use this program, you can also increase the cache time of an inputted GPG password with the | |||
.I default-cache-ttl | |||
and | |||
.I max-cache-ttl | |||
variables in your | |||
.I | |||
gpg-agent.conf. | |||
.SH MUTT-WIZARD'S NEOMUTT CONFIGURATION | |||
Here is a list of not only mutt-wizard's particular defaults, but what you need, to get the most out of email accounts configured with mutt-wizard. | |||
.B \f[I]/usr/share/mutt-wizard/mutt-wizard.muttrc\f[R] | |||
Default mutt settings. | |||
.TP | |||
.B Color | |||
mutt-wizard's default settings add color to messages in the index and color mail details to make them easier to see. | |||
New mail, in addition to being marked by the typical N, will also be bold. | |||
.B \f[I]/usr/share/mutt-wizard/mailcap\f[R] | |||
Default mailcap file. | |||
.TP | |||
.B Movement with h/j/k/l | |||
Use vim keys to move down | |||
.I j | |||
or up | |||
.I k | |||
in mail, while | |||
.I l | |||
opens mail, then the attachment view, then an attachment, while | |||
.I h | |||
is the reverse. | |||
While mail is open, go to next or previous mail with | |||
.I J | |||
and | |||
.I K. | |||
In the mail index, | |||
.I d | |||
and | |||
.I u | |||
go down and up by a half page and | |||
.I gg | |||
and | |||
.I G | |||
go to the very top and very bottom. | |||
.TP | |||
.B Search mail | |||
If you have | |||
.B notmuch | |||
configured with your proper mail directory (see above), you may run | |||
.I ctrl-f | |||
to search for mail containing any given sequence. | |||
Even without notmuch, | |||
.I L | |||
limits mail, showing only those with the given sequence in the subject while | |||
.I A | |||
shows all mail (same as limiting to "all"). | |||
.TP | |||
.B Deleting mail | |||
.I D | |||
deletes mail, while | |||
.I U | |||
undeletes it (type in mail number to get to deleted mail). Note that | |||
.I S | |||
saves your mailbox, finalizing deletion. If you have a | |||
.I Trash | |||
box, deleted mail is moved there. If you want it to skip that and simply be deleted, comment out or remove the | |||
.I set trash | |||
line in that account's muttrc. | |||
.TP | |||
.B Send mail | |||
.I m | |||
creates a new mail message; | |||
.I r | |||
replies to the selected message; | |||
.I R | |||
replies all to the selected message and | |||
.I f | |||
fowards the selected message. | |||
.TP | |||
.B Compose mail screen | |||
Once you write mail and save the buffer you will be brought to the compose screen. Press | |||
.I a | |||
to add attachments, use | |||
.I s/t/c/b/d | |||
to change the subject/to/CC/BCC/description. Press | |||
.I S | |||
to change the signature/encryption. Press | |||
.I y | |||
to send the mail. | |||
.TP | |||
.B Saving and autocompleting email addresses with abook | |||
Install the optional dependency abook and you will be able to save the sender's email address with | |||
.I a. | |||
Once this is done, when you are typing in any email/contact prompt, you may press | |||
.I Tab | |||
to find contacts matching your input. Although abook is often used with mutt, it is also a useful program in its own right. | |||
.TP | |||
.B Switching and moving mail between mailboxes | |||
The | |||
.I g | |||
key can be paired with several other keys to automatically move to another mailbox: gi: Inbox; gs: Sent; gd: Drafts; ga: Archive; gS: Spam; gj: Junk; gt: Trash. These bindings will only be present for accounts that have the boxes in question. Instead of | |||
.I g, | |||
you can also press | |||
.I C | |||
to copy mail or | |||
.I M | |||
to move mail to the same boxes. | |||
.TP | |||
.B Switching between accounts | |||
mutt-wizard can configure as many as nine accounts each numbered by the lowest available number when configured. Press | |||
.I i | |||
followed by an account's number to change to that account: i2, i5, etc. | |||
.I ctrl-b | |||
to open a menu to select a url you want to open in you browser. | |||
.B \f[I]/usr/share/mutt-wizard/domains.csv\f[R] | |||
Email server database. | |||
.SH BUGS | |||
.PP | |||
GitHub Issues: <<https://github.com/rpuntaie/mutt-wizard/issues>> | |||
.SH AUTHORS | |||
.TP | |||
.B Sidebar | |||
mutt-wizard enables the sidebar by default which displays your account's boxes with mail tallies. | |||
.I B | |||
will toggle the sidebar. Move up and down in it with | |||
.I ctrl-k/j. | |||
Open a box with | |||
.I ctrl-o. | |||
.B \f[I]Luke Smith\f[R] <<luke@lukesmith.xyz>> | |||
Original author, started in 2018. | |||
.RS | |||
.PP | |||
Github <<https://github.com/lukesmithxyz/mutt-wizard>> | |||
.PP | |||
Gitlab <<https://gitlab.com/lukesmithxyz/mutt-wizard>> | |||
.RE | |||
.TP | |||
.B More information | |||
Remember that you can press | |||
.I ? | |||
at any time in neomutt to get a list of all key-bindings and functions. This list can also vary for different context menus. | |||
.SH AUTHORS | |||
Written by Luke Smith <luke@lukesmith.xyz> originally in 2018. | |||
.B \f[I]Roland Puntaier\f[R] <<roland.puntaier@gmail.com>> | |||
Bugfixes, Improvements in 2019. | |||
.RS | |||
.PP | |||
GitHub: <<https://github.com/rpuntaie/mutt-wizard>> | |||
.RE | |||
.SH LICENSE | |||
.PP | |||
GPLv3 | |||
.SH SEE ALSO | |||
.BR neomutt (1), | |||
.BR neomuttrc (1) | |||
.BR mbsync (1), | |||
.BR msmtp (1), | |||
.BR notmuch (1), | |||
.BR abook (1) | |||
.PP | |||
\f[B]neomutt\f[R](1), \f[B]neomuttrc\f[R](1) \f[B]mbsync\f[R](1), | |||
\f[B]msmtp\f[R](1), \f[B]notmuch\f[R](1), \f[B]abook\f[R](1) |
@@ -157,6 +157,7 @@ inventati.org,mail.autistici.org,993,smtp.autistici.org,465 | |||
itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.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 | |||
lavabit.com,lavabit.com,993,lavabit.com,587 | |||
linuxmail.org,imap.mail.com,993,smtp.mail.com,587 | |||
live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 | |||
@@ -263,3 +264,5 @@ 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 | |||
zoho.com,imap.zoho.com,993,smtp.zoho.com,465 | |||
mailo.com,mail.mailo.com,993,mail.mailo.com,465 | |||
chello.at,mail.upcmail.at,995,mail.upcmail.at,465 |
@@ -1,7 +1,7 @@ | |||
text/plain; $EDITOR %s ; | |||
text/html; openfile %s ; nametemplate=%s.html | |||
text/html; mwopen %s ; nametemplate=%s.html | |||
text/html; w3m -I %{charset} -T text/html; copiousoutput; | |||
image/*; muttimage %s ; copiousoutput | |||
image/*; mwimage %s ; copiousoutput | |||
video/*; setsid mpv --quiet %s &; copiousoutput | |||
application/pdf; openfile %s ; | |||
application/pdf; mwopen %s ; | |||
application/pgp-encrypted; gpg -d '%s'; copiousoutput; |
@@ -1,8 +1,15 @@ | |||
# vim: filetype=neomuttrc | |||
# This file contains all of mutt-wizard's default settings. | |||
# | |||
# This file contains all of mutt-wizard's defaults. | |||
# mutt-wizard will have this file sourced from your muttrc. | |||
# The vim-like key binding has been established by comparing different dotfiles. | |||
# You can change bindings after the sourcing of the defaults. | |||
# Or you can keep mutt-wizard from sourcing its defaults with this comment in your muttrc: | |||
# #source /usr/share/mutt-wizard/mutt-wizard.muttrc | |||
# | |||
# In the interest of seamless updating, do not edit this file. | |||
# If you want to override any settings, set those in your muttrc. | |||
# ==================== SETTINGS ==================== # | |||
set mailcap_path = /usr/share/mutt-wizard/mailcap | |||
set date_format="%y/%m/%d %I:%M%p" | |||
set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" | |||
@@ -10,64 +17,21 @@ set sort = 'reverse-date' | |||
set smtp_authenticators = 'gssapi:login' | |||
set query_command = "abook --mutt-query '%s'" | |||
set rfc2047_parameters = yes | |||
set sleep_time = 0 # Pause 0 seconds for informational messages | |||
set markers = no # Disables the `+` displayed at line wraps | |||
set mark_old = no # Unread mail stay unread until read | |||
set mime_forward = yes # attachments are forwarded with mail | |||
set wait_key = no # mutt won't ask "press key to continue" | |||
set fast_reply # skip to compose when replying | |||
set fcc_attach # save attachments with the body | |||
set forward_format = "Fwd: %s" # format of subject when forwarding | |||
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) | |||
set sleep_time = 0 # Pause 0 seconds for informational messages | |||
set markers = no # Disables the `+` displayed at line wraps | |||
set mark_old = no # Unread mail stay unread until read | |||
set mime_forward = yes # attachments are forwarded with mail | |||
set wait_key = no # mutt won't ask "press key to continue" | |||
set fast_reply # skip to compose when replying | |||
set fcc_attach # save attachments with the body | |||
set forward_format = "Fwd: %s" # format of subject when forwarding | |||
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 application/pgp-encrypted | |||
alternative_order text/plain text/enriched text/html | |||
bind index,pager i noop | |||
bind index,pager g noop | |||
bind index,pager M noop | |||
bind index,pager C noop | |||
bind index \Cf noop | |||
# General rebindings | |||
bind attach <return> view-mailcap | |||
bind attach l view-mailcap | |||
bind editor <space> noop | |||
bind pager,attach h exit | |||
bind pager j next-line | |||
bind pager k previous-line | |||
bind pager l view-attachments | |||
bind index gg first-entry | |||
bind index G last-entry | |||
bind index D delete-message | |||
bind index U undelete-message | |||
bind index L limit | |||
bind index h noop | |||
bind index l display-message | |||
#bind browser h goto-parent | |||
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 index,pager,browser d half-down | |||
bind index,pager,browser u half-up | |||
bind index,pager S sync-mailbox | |||
bind index,pager R group-reply | |||
bind index \031 previous-undeleted # Mouse wheel | |||
bind index \005 next-undeleted # Mouse wheel | |||
bind pager \031 previous-line # Mouse wheel | |||
bind pager \005 next-line # Mouse wheel | |||
bind editor <Tab> complete-query | |||
macro index,pager a "|abook --add-email\n" 'add sender to abook' | |||
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" | |||
macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >\${XDG_CACHE_HOME:-~/.cache}/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat \${XDG_CACHE_HOME:-~/.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 | |||
set sidebar_visible = yes | |||
set sidebar_width = 20 | |||
@@ -75,6 +39,62 @@ 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?' | |||
# ==================== settings ==================== # | |||
# =================== SHORTCUTS ==================== # | |||
# Non-standard, more vim-like key mappings | |||
# | |||
# Free keys | |||
bind index h noop | |||
bind index,pager d noop #used for dX | |||
bind index,pager i noop #used for goto iXY and i[1-9] in account muttrc (XY = 2 mailbox letters) | |||
bind index,pager M noop #used for CXY, "move" to XY in account muttrc | |||
bind index,pager C noop #used for CXY, "copy" to XY in account muttrc | |||
bind pager,attach,browser,index g noop | |||
# Moving between views the vim way | |||
bind attach,index gg first-entry | |||
bind attach,index G last-entry | |||
bind pager,browser gg top-page | |||
bind pager,browser G bottom-page | |||
bind pager G bottom | |||
bind pager k previous-line | |||
bind pager j next-line | |||
# l gets from index to mail to attachents to system view via mailcap | |||
# h back vim-like (q by mutt) | |||
bind index l display-message | |||
bind browser l select-entry | |||
bind pager l view-attachments | |||
bind attach l view-mailcap | |||
bind attach <return> view-mailcap | |||
bind pager,attach h exit | |||
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" | |||
# Moving inside view as in vim | |||
bind attach,index,pager,browser \Cd half-down | |||
bind attach,index,pager,browser \Cu half-up | |||
bind attach,browser,pager,index \Cf next-page | |||
bind attach,browser,pager,index \Cb previous-page | |||
bind browser,pager,index \Ce next-line | |||
bind browser,pager,index \Cy previous-line | |||
# and using mouse | |||
bind index \031 previous-undeleted # Mouse wheel | |||
bind index \005 next-undeleted # Mouse wheel | |||
bind pager \031 previous-line # Mouse wheel | |||
bind pager \005 next-line # Mouse wheel | |||
# | |||
# Using other dX and gX keys | |||
bind index gl limit | |||
macro index gL "<limit>all\n" "show all messages (undo limit)" | |||
# Threads | |||
bind browser,pager,index N search-opposite | |||
bind pager,index dT delete-thread | |||
bind pager,index dt delete-subthread | |||
bind pager,index gt next-thread | |||
bind pager,index gT previous-thread | |||
bind index za collapse-thread | |||
bind index zA collapse-all | |||
bind index - collapse-thread | |||
bind index _ collapse-all | |||
# Sidebar (J/K goes to previou/next mail by mutt) | |||
bind index,pager \Ck sidebar-prev | |||
bind index,pager \Cj sidebar-next | |||
bind index,pager \Co sidebar-open | |||
@@ -82,19 +102,37 @@ bind index,pager \Cl sidebar-open | |||
bind index,pager \Cp sidebar-prev-new | |||
bind index,pager \Cn sidebar-next-new | |||
bind index,pager B sidebar-toggle-visible | |||
# Edit the vim way | |||
# D, U = delete/undelete by pattern by mutt | |||
bind pager,index dd delete-message #u is undelete by mutt | |||
bind index,pager gr group-reply #R is recall postponed by mutt | |||
bind editor <space> noop | |||
bind editor <Tab> complete-query | |||
bind index,pager V view-raw-message | |||
# Other | |||
bind pager t display-toggle-weed | |||
# | |||
# Macros | |||
macro index \Cr "<tag-pattern>~U<enter>\ | |||
<tag-prefix><clear-flag>N<untag-pattern>.<enter>" \ | |||
"mark all messages as read" | |||
macro index,pager ga "|abook --add-email\n" 'add sender to abook' #"a" alone, add to alias | |||
macro index S "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >\${XDG_CACHE_HOME:-~/.cache}/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat \${XDG_CACHE_HOME:-~/.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 pager gu "|urlscan<enter>" "call urlscan to open links" | |||
# =================== shortcuts ==================== # | |||
# Default index colors: | |||
## ===================== COLOR ===================== # | |||
# Default index colors | |||
color index yellow default '.*' | |||
color index_author red default '.*' | |||
color index_number blue default | |||
color index_subject cyan default '.*' | |||
# New mail is boldened: | |||
# New mail is boldened | |||
color index brightyellow black "~N" | |||
color index_author brightred black "~N" | |||
color index_subject brightcyan black "~N" | |||
# Other colors and aesthetic settings: | |||
# Other colors and aesthetic settings | |||
mono bold bold | |||
mono underline underline | |||
mono indicator reverse | |||
@@ -124,8 +162,7 @@ color signature brightgreen default | |||
color bold black default | |||
color underline black default | |||
color normal default default | |||
# Regex highlighting: | |||
# Regex highlighting | |||
color header blue default ".*" | |||
color header brightmagenta default "^(From)" | |||
color header brightcyan default "^(Subject)" | |||
@@ -149,3 +186,4 @@ color body brightyellow red "^gpg: BAD signature from.*" | |||
mono body bold "^gpg: Good signature" | |||
mono body bold "^gpg: BAD signature from.*" | |||
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" | |||
## ===================== color ===================== # |
@@ -6,50 +6,50 @@ echo | |||
bats --tap test_mw.bats | |||
echo | |||
echo Integration tests with a working email: | |||
echo | |||
echo "Integration tests need working email $mwaddr" | |||
echo "CTRL-C to skip" | |||
#modify | |||
if [[ -z $MAILDIR ]] || [[ -z $mwaddr ]]; then | |||
if [ -z "$MAILDIR" ] || [ -z "$mwaddr" ]; then | |||
echo "First do:" | |||
[[ -z $MAILDIR ]] && echo "export MAILDIR=..." | |||
[[ -z $mwaddr ]] && echo "export mwaddr=your.email@gmail.com" | |||
[ -z "$MAILDIR" ] && echo "export MAILDIR=..." | |||
[ -z "$mwaddr" ] && echo "export mwaddr=your.email@gmail.com" | |||
exit | |||
fi | |||
cd .. && sudo make install && OK="OK" | |||
if [[ "$OK" == "OK" ]]; then | |||
if [ "$OK" = "OK" ]; then | |||
echo "Warning: Out with CTRL-C if your mail (config) files are important here." | |||
export mwmaildir=$MAILDIR | |||
export mwname='r n' | |||
export mwlogin=$mwaddr | |||
export mwpass="${mwpass:-mutt-wizard-$mwaddr}" | |||
mwaccmutt="${mwaddr//[.@]/_}" | |||
mwaccmaildir="$mwmaildir/$mwaccmutt" # folder name as shown by mutt and opens with gf in vim | |||
mwaccmaildir="$mwmaildir/$mwaddr" | |||
rm -rf $mwaccmaildir | |||
[ -f "${PASSWORD_STORE_DIR:-~/.password-store}/$mwpass.gpg" ] || pass insert $mwpass | |||
echo "= manual test 1 =" | |||
echo "= Test 1 =" | |||
mwtype=online mw add | |||
echo "=> In another window, start mutt and verify that mails are shown" | |||
echo "=> Then anwer with N" | |||
echo "=> In another prompt, start mutt and verify that mails are shown" | |||
echo "=> Then answer with N" | |||
mw purge | |||
rm -rf $mwaccmaildir | |||
echo "= manual test 2 =" | |||
echo "= Test 2 =" | |||
mwtype=offline mw add | |||
mailsync | |||
echo "=> In another window, start mutt and verify that mails are shown" | |||
mw | |||
echo "=> In another prompt, start mutt and verify that mails are shown" | |||
echo "=> Press i1, wait, press i2. Verify that mutt is fast again after i2." | |||
echo "=> Press gm and gM, to start mailsync." | |||
echo "=> Anwer with y." | |||
echo "=> Press gm and gM, to start mw sync." | |||
echo "=> Answer with Y and check that mbsyncrc, msmtp/config and mutt/accounts are gone." | |||
mw purge | |||
rm -rf $mwaccmaildir | |||
fi | |||
cd $CD |
@@ -12,22 +12,35 @@ run_only_test() { | |||
fi | |||
} | |||
# these are called for every test | |||
setup() | |||
{ | |||
#run_only_test 4 | |||
#run_only_test 6 | |||
rm -rf mwtesttmp | |||
XDG_CONFIG_HOME=mwtesttmp/config \ | |||
MAILDIR=mwtesttmp/share/mail \ | |||
XDG_CACHE_HOME=mwtesttmp/cache \ | |||
prefix="$PWD" \ | |||
source ../bin/mw | |||
export NOTMUCH_CONFIG=mwtesttmp/config/notmuch-config | |||
export mwname="real name" | |||
export mwaddr="full.addr@gmail.com" | |||
export mwlogin="$mwaddr" | |||
export mwmailboxes="[Gmail]/INBOX" | |||
export mwshare=$PWD/../share | |||
function pass() { return 0; } | |||
export pass | |||
function _mwcheckinternet() { return 0; } | |||
export _mwcheckinternet | |||
function _mwcheckcert() { return 0; } | |||
export _mwcheckcert | |||
function pgrep() { return 0; } | |||
export pgrep | |||
function crontab() { echo 'none'; } | |||
export crontab | |||
function _mwsyncandnotify() { echo "$mwaddr"; } | |||
export _mwsyncandnotify | |||
} | |||
teardown() | |||
{ | |||
if [ -z "$TEST_FUNCTION" ] | |||
@@ -36,52 +49,97 @@ teardown() | |||
fi | |||
} | |||
#1 | |||
# 1 | |||
@test "check config" { | |||
[ "$mwmbsyncrc" = "mwtesttmp/config/isync/mbsyncrc" ] | |||
[ "$mwmsmtprc" = "mwtesttmp/config/msmtp/config" ] | |||
} | |||
#2 | |||
# 2 | |||
@test "add online" { | |||
export mwtype=online | |||
rm -rf mwtesttmp | |||
export mailboxes="[Gmail]/Drafts" | |||
run mwadd | |||
mwtype="online" run _mwadd | |||
[ -f mwtesttmp/config/mutt/muttrc ] | |||
[ -f mwtesttmp/config/mutt/accounts/1-$mwaddr.muttrc ] | |||
[ -f mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.online.muttrc ] | |||
[ "$(cat mwtesttmp/config/isync/mbsyncrc | sed -ne '/^\s*\w/p')" = "" ] | |||
[ ! "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
[ "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
[ ! "$(cat mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.online.muttrc | sed -ne '/smtp_url/p')" = "" ] | |||
[ ! -f mwtesttmp/config/notmuch-config ] | |||
} | |||
#3 | |||
# 3 | |||
@test "add offline unsuccessful" { | |||
export mwtype=offline | |||
rm -rf mwtesttmp | |||
run mwadd | |||
export mwmailboxes="[Gmail]/OTHER" | |||
mwtype="offline" run _mwadd | |||
[ -f mwtesttmp/config/mutt/muttrc ] | |||
[ -d mwtesttmp/config/mutt/accounts ] | |||
[ ! -f mwtesttmp/config/mutt/accounts/1-$mwaddr.muttrc ] | |||
[ ! -f mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.offline.muttrc ] | |||
[ "$(cat mwtesttmp/config/isync/mbsyncrc | sed -ne '/^\s*\w/p')" = "" ] | |||
[ "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
[ ! -f mwtesttmp/config/notmuch-config ] | |||
} | |||
#4 | |||
# 4 | |||
@test "add offline successfully" { | |||
export mwtype=offline | |||
export mailboxes="[Gmail]/Drafts" | |||
rm -rf mwtesttmp | |||
run mwadd | |||
mwtype="offline" run _mwadd | |||
[ -f mwtesttmp/config/mutt/muttrc ] | |||
[ -d mwtesttmp/config/mutt/accounts ] | |||
[ -f mwtesttmp/config/mutt/accounts/1-$mwaddr.muttrc ] | |||
[ -f mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.offline.muttrc ] | |||
[ -f mwtesttmp/config/notmuch-config ] | |||
cat mwtesttmp/config/isync/mbsyncrc | sed -ne '/^\s*\w/p' | |||
[ ! "$(cat mwtesttmp/config/isync/mbsyncrc | sed -ne '/^\s*\w/p')" = "" ] | |||
[ ! "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
run mwlist | |||
[ "$(cat mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.online.muttrc | sed -ne '/smtp_url/p')" = "" ] | |||
run _mwlist | |||
[ "$(echo $lines | awk '{print $2}')" = "$mwaddr" ] | |||
} | |||
# 5 | |||
@test "delete account" { | |||
mwtype="online" run _mwadd | |||
mwtype="offline" run _mwadd | |||
pick_delete() | |||
{ | |||
_mwpick delete && _mwdelete | |||
} | |||
export pick_delete | |||
mwpick="1" run pick_delete | |||
[ ! -f mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.online.muttrc ] | |||
[ ! "$(cat mwtesttmp/config/isync/mbsyncrc | sed -ne '/^\s*\w/p')" = "" ] | |||
[ ! "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
} | |||
# 6 | |||
@test "cron" { | |||
mwcronminutes=99 run _mwcron | |||
chkline="${lines[1]}" | |||
[ "${chkline::16}" = "mw cronjob added" ] | |||
function crontab() { echo 'mw sync'; } | |||
export crontab | |||
mwcronremove=y run _mwcron | |||
chkline="${lines[1]}" | |||
[ "${chkline#*cronjob}" = " removed." ] | |||
} | |||
# 7 | |||
@test "sync" { | |||
mwtype="offline" run _mwadd | |||
function pgrep() { [ "$1" = "-u" ] && return 0 || return 1; } | |||
export pgrep | |||
run _mwsync | |||
[ "${lines// /}" = "full.addr@gmail.com" ] | |||
} | |||
# 8 | |||
@test "add pop" { | |||
export mwaddr="full.addr@chello.at" | |||
mwtype="offline" run _mwadd | |||
[ -f mwtesttmp/config/mutt/muttrc ] | |||
[ -d mwtesttmp/config/mutt/accounts ] | |||
[ -f mwtesttmp/config/mutt/accounts/1-$mwaddr.mwonofftype.offline.muttrc ] | |||
[ -f mwtesttmp/config/notmuch-config ] | |||
[ ! "$(cat mwtesttmp/config/msmtp/config | sed -ne '/^account/p')" = "" ] | |||
[ ! "$(cat mwtesttmp/config/getmail/$mwaddr | sed -ne '/^\s*\w/p')" = "" ] | |||
run _mwlist | |||
[ "$(echo $lines | awk '{print $2}')" = "$mwaddr" ] | |||
} |