Browse Source

Merge pull request #1 from LukeSmithxyz/master

Update
pull/563/head
Luke Bubar 4 years ago
committed by GitHub
parent
commit
7044a44dbb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 382 additions and 401 deletions
  1. +3
    -0
      FUNDING.yml
  2. +4
    -2
      Makefile
  3. +33
    -16
      README.md
  4. +0
    -69
      bin/mailsync
  5. +221
    -221
      bin/mw
  6. +1
    -1
      bin/openfile
  7. +57
    -18
      mw.1
  8. +50
    -69
      share/domains.csv
  9. +2
    -0
      share/mailcap
  10. +11
    -5
      share/mutt-wizard.muttrc

+ 3
- 0
FUNDING.yml View File

@@ -0,0 +1,3 @@
github: lukesmithxyz
custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"]
patreon: lukesmith

+ 4
- 2
Makefile View File

@@ -4,7 +4,9 @@ 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
@@ -32,7 +34,7 @@ install:

uninstall:
for script in bin/*; do \
rm -f $(DESTDIR)$(PREFIX)/$$script; \
rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \
done
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1


+ 33
- 16
README.md View File

@@ -3,16 +3,15 @@
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
- Mail stored offline so you can view and write email while you're 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
- 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.

@@ -26,14 +25,34 @@ 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/).

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.
The mutt-wizard is run with the command `mw`. 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` -- delete an added account
- `mw purge` -- delete all accounts and settings
- `mw cron` -- toggle/configure a cronjob to sync mail
- `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
- `pass edit mw-your@email.com` -- revise an account's password

### Options usable when adding an account

#### Providing arguments

- `-u` -- Give an account username if different from the email address. If you use my [emailwiz](https://github.com/lukesmithxyz/emailwiz), give your username with this option. Not necessary for other accounts.
- `-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 587)
- `-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

- `-p` -- Add a Protonmail account
- `-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.

## Dependencies

@@ -47,10 +66,8 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian
### Optional

- `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 syncthing mail with `mailsync`
- `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.
- `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.

@@ -105,12 +122,12 @@ mutt-wizard is free/libre software, licensed under the GPLv3.

## 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.
- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again.
- 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 confired to work for Mac OS now)
- 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)

+ 0
- 69
bin/mailsync View File

@@ -1,69 +0,0 @@
#!/bin/sh

# Sync mail and give notification if there is new mail.

# 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 ;}

# 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."

# Required to display notifications if run as a cronjob:
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
export DISPLAY=:0.0

# For individual configurations:
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
pgrep i3blocks >/dev/null && STATUSBAR="i3blocks" || STATUSBAR="dwmblocks"

# 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 --app-name="mutt-wizard" "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/.*\///")"
mbsync "$acc"
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)
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 --app-name="mutt-wizard" "📧$from:" "$subject" &
done
fi
}

# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")"
else
accounts=$*
fi

echo " 🔃" > /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 ) 2>/dev/null

# Parallelize multiple accounts
for account in $accounts
do
syncandnotify &
done

wait
rm -f /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 ) 2>/dev/null

notmuch new 2>/dev/null

#Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.config/mutt/.mailsynclastrun"

+ 221
- 221
bin/mw View File

@@ -7,85 +7,85 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
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\` 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
pass_prefix="mw-"
muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location
accdir="$muttdir/accounts" # Directory for account settings
maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage
emailre=".+@.+\..+" # Regex to confirm valid email address
muttshare="$prefix/share/mutt-wizard"
mbsyncrc="$HOME/.mbsyncrc"
mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}"
mwconfig="$muttshare/mutt-wizard.muttrc"
cachedir="$HOME/.cache/mutt-wizard"
cachedir="${XDG_CACHE_HOME:-$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
msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config"
msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log"
MARKER="# mw-autogenerated"
alias mbsync='mbsync -c "$mbsyncrc"'

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
[ -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)" ;}
getaccounts() { accounts="$(find -L "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;}

list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;}

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
logfile $msmtplog
"
msmtp_profile="account $title
msmtp_profile="account $fulladdr
host $smtp
port $sport
port ${sport:-587}
from $fulladdr
user $login
passwordeval \"pass mutt-wizard-$title\"
$starttlsoff
passwordeval \"pass $pass_prefix$fulladdr\"
$tlsline
"
mbsync_profile="IMAPStore $title-remote
mbsync_profile="IMAPStore $fulladdr-remote
Host $imap
Port $iport
Port ${iport:-993}
User $login
PassCmd \"pass mutt-wizard-$title\"
PassCmd \"pass $pass_prefix$fulladdr\"
AuthMechs LOGIN
SSLType $ssltype
AuthMech LOGIN
SSLType ${ssltype:-IMAPS}
CertificateFile $sslcert

MaildirStore $title-local
MaildirStore $fulladdr-local
Subfolders Verbatim
Path ~/.local/share/mail/$title/
Inbox ~/.local/share/mail/$title/INBOX
Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/
Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/INBOX
Flatten .

Channel $title
Channel $fulladdr
Expunge Both
Master :$title-remote:
Slave :$title-local:
Master :$fulladdr-remote:
Slave :$fulladdr-local:
Patterns * !\"[Gmail]/All Mail\"
Create Both
SyncState *
MaxMessages $maxmes
MaxMessages ${maxmes:-0}
ExpireUnread no
# End profile
"

if [ "$accounttype" = "offline" ]; then
if [ -z "${online+x}" ]; then
mutt_profile="# vim: filetype=neomuttrc
# muttrc file for account $title
# 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 = \"$maildir/$fulladdr\"
set header_cache = $cachedir/$fulladdr/headers
set message_cachedir = $cachedir/$fulladdr/bodies
set mbox_type = Maildir

bind index,pager gg noop
@@ -93,21 +93,21 @@ 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\"
macro index o \"<shell-escape>mw -y $fulladdr<enter>\" \"run mbsync to sync $fulladdr\"
unmailboxes *
"
else
mutt_profile="# vim: filetype=neomuttrc
# muttrc file for account $title
# muttrc file for account $fulladdr
set realname = \"$realname\"
set from = \"$fulladdr\"
set sendmail = \"$prefix/bin/msmtp -a $title\"
set sendmail = \"msmtp -a $fulladdr\"
alias me $realname <$fulladdr>
set folder = \"imaps://$fulladdr@$imap:$iport\"
set folder = \"imaps://$login@$imap:${iport:-993}\"
set imap_user = \"$login\"
set header_cache = $cachedir/$title/headers
set message_cachedir = $cachedir/$title/bodies
set imap_pass = \"\`pass mutt-wizard-$title\`\"
set header_cache = $cachedir/$fulladdr/headers
set message_cachedir = $cachedir/$fulladdr/bodies
set imap_pass = \"\`pass $pass_prefix$fulladdr\`\"

set mbox_type = Maildir
set ssl_starttls = yes
@@ -121,196 +121,144 @@ bind index gg first-entry
unmailboxes *
"
fi
printf "DONE.\\n"
}

parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"

[ -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 your would like to delete (by number):"
list
read -r input
match="^$input:"
else
match=" $fulladdr$"
getaccounts
fi

fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')"

[ -z "$fulladdr" ] && echo "Invalid account name given." && return 1

sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu
rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc"
sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu
sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu
pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1
}

askinfo() { \
printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m"
read -r fulladdr
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 "$emailre"; 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' && break;;
*)
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"
{ [ -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" = 465 ] && tlsline="tls_starttls off"
[ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" &&
read -r realname
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
}

createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr"
"$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr"
rm -f "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" ;}

writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr"

# Get accounts and find the first missing account number (max. 9).
getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "$x" || { export idnum="$x"; break ;}; done

# Configure msmtprc for sending mail.
[ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc"
echo "$msmtp_profile" >> "$msmtprc"
# On Ubuntu/Debian, a link is needed since they use an older version.
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"

# Create the mbsync config file.
mkdir -p "${mbsyncrc%/*}"
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
# Create a muttrc for viewing mail.
echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc"
[ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc"
! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc"
! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc"
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$idnum-$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" $MARKER" >> "$muttrc"

notmuchauto # Create a notmuch config file if not present already.
}

getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1
pass insert "mutt-wizard-$title" && break; done ;}
getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1
pass insert "$pass_prefix$fulladdr" && break; done ;}

formatShortcut() { toappend="$toappend
macro index,pager g$1 \"<change-folder>=$3<enter>\" \"go to $2\" $MARKER
macro index,pager M$1 \";<save-message>=$3<enter>\" \"move mail to $2\" $MARKER
macro index,pager C$1 \";<copy-message>=$3<enter>\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;}

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 ;}
setBox() { toappend="$toappend
set $1 = \"+$2\" $MARKER" ;}

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/{}"
getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX
Drafts
Junk
Trash
Sent
Archive" && return 0
if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then
[ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu
return 0
else
echo "$mailboxes"
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"
finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new"
sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu"
toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )"
for x in $mailboxes; do
case $x in
*[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;;
*[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;;
*[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;;
*[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;;
*[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;;
*[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;;
*[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;;
esac
done
echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc"
[ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mmw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr"
command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview"
return 0
}

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
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)") | crontab - &&
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
}
syncwrapper() { mbsync "${1:--a}" &
( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null
wait
( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null
notmuch new ;}

notmuchauto() { \
[ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
@@ -322,7 +270,7 @@ name=$realname
primary_email=$fulladdr
[new]
tags=unread;inbox;
ignore=
ignore=.mbsyncstate;.uidvalidity
[search]
exclude_tags=deleted;spam;
[maildir]
@@ -331,28 +279,80 @@ synchronize_flags=true
gpg_path=$GPG"
echo "$nmbasic" > "$NOTMUCH_CONFIG" ;}

trap 'echo -e "\033[0m\n"; exit' STOP INT ABRT KILL
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; }

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 ;;
while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in
l) setact list || 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" ;;
m) setact add || exit 1 ; maxmes="$OPTARG" ;;
o) setact add || exit 1 ; online=True ;;
f) setact add || exit 1 ; force=True ;;
x) setact add || exit 1 ; password="$OPTARG" ;;
p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work."
imap="127.0.0.1"
iport="1143"
smtp="127.0.0.1"
sport="1025"
ssltype="None"
tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')"
setact add || exit 1
;;
*) 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

Options allowed with -a:
-u Account login name if not full address
-n "Real name" to be on the email account
-i IMAP server address
-I IMAP server port
-s SMTP server address
-S SMTP server port
-x Password for account (recommended to be in double quotes)
-p Install for a Protonmail account.
-o Configure address, but keep mail online.
-b 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 ${pass_prefix}your@email.com\`.
EOF
exit 1
;;
esac done

! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit

case "$action" in
list) list ;;
add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;;
delete) delete $fulladdr ;;
sync) syncwrapper $fulladdr ;;
esac

+ 1
- 1
bin/openfile View File

@@ -1,7 +1,7 @@
#!/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"
[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open"
mkdir -p "/tmp/$USER-mutt-tmp"
file="/tmp/$USER-mutt-tmp/$(basename "$1")"
rm -f "$file"


+ 57
- 18
mw.1 View File

@@ -3,10 +3,12 @@
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 with it for
takes a user email account and sets up a terminal-based email interface for it with
.B neomutt.
This can include offline email with
.B isync/mbsync
@@ -16,22 +18,61 @@ 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
.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 server address
.TP
.B -I
IMAP server port (assumed to be 993 if not specified)
.TP
.B -s
SMTP server address
.TP
.B -S
SMTP server port (assumed to be 587 if not specified)
.TP
.B -x
Account password. You will be prompted for the password interactively if this option is not given.
.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 -p
Add a Protonmail account. Protonmail Bridge must be installed and set up.
.SH DETAILS
.TP
.B Mail location
@@ -52,11 +93,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 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


+ 50
- 69
share/domains.csv View File

@@ -1,9 +1,12 @@
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
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
accountant.com,imap.mail.com,993,smtp.mail.com,587
activist.com,imap.mail.com,993,smtp.mail.com,587
ad.unsw.edu.au,outlook.office365.com,993,smtp.office365.com,587
adexec.com,imap.mail.com,993,smtp.mail.com,587
airmail.cc,mail.cock.li,993,mail.cock.li,587
allergist.com,imap.mail.com,993,smtp.mail.com,587
@@ -13,6 +16,7 @@ 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,12 +32,15 @@ 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
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
birdlover.com,imap.mail.com,993,smtp.mail.com,587
bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587
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
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
@@ -44,9 +51,11 @@ chef.net,imap.mail.com,993,smtp.mail.com,587
chemist.com,imap.mail.com,993,smtp.mail.com,587
chrissx.ga,chrissx.ga,993,chrissx.ga,25
clarkson.edu,imap.gmail.com,993,smtp.gmail.com,587
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
@@ -77,6 +86,7 @@ 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
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
europe.com,imap.mail.com,993,smtp.mail.com,587
fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465
@@ -86,65 +96,23 @@ forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465
forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465
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
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
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
hotmail.co.*,outlook.office365.com,993,smtp.office365.com,587
hotmail.com.*,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
@@ -157,15 +125,19 @@ 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
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
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
@@ -174,7 +146,9 @@ 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
luther.edu,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
@@ -182,6 +156,7 @@ 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
memeware.net,mail.cock.li,993,mail.cock.li,587
metu.edu.tr,imap.metu.edu.tr,993,smtp.metu.edu.tr,465
ml1.net,imap.fastmail.com,993,smtp.fastmail.com,465
@@ -189,6 +164,7 @@ 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
@@ -208,9 +184,7 @@ 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
paranoici.org,mail.autistici.org,993,smtp.autistici.org,465
pm.me,127.0.0.1,1143,127.0.0.1,1025
@@ -218,35 +192,43 @@ 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
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
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
riseup.net,mail.riseup.net,993,mail.riseup.net,465
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
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
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
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
studenti.unipi.it,outlook.office365.com,995,smtp.office365.com,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
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
@@ -266,7 +248,10 @@ ua.pt,outlook.office365.com,993,mail.ua.pt,25
uach.mx,imap.gmail.com,993,smtp.gmail.com,587
ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587
uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465
uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587
unilodz.eu,outlook.office365.com,993,smtp.office365.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
@@ -279,6 +264,7 @@ 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,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
@@ -288,16 +274,11 @@ 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
ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465
e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00

+ 2
- 0
share/mailcap View File

@@ -3,5 +3,7 @@ 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 ;
video/*; setsid mpv --quiet %s &; copiousoutput
audio/*; mpv %s ;
application/pdf; openfile %s ;
application/pgp-encrypted; gpg -d '%s'; copiousoutput;
application/pgp-keys; gpg --import '%s'; copiousoutput;

+ 11
- 5
share/mutt-wizard.muttrc View File

@@ -22,8 +22,9 @@ 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
@@ -46,7 +47,7 @@ bind index U undelete-message
bind index L limit
bind index h noop
bind index l display-message
bind index <space> tag-entry
bind index,query <space> tag-entry
#bind browser h goto-parent
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder"
bind index,pager H view-raw-message
@@ -63,10 +64,15 @@ bind pager \031 previous-line # Mouse wheel
bind pager \005 next-line # Mouse wheel
bind editor <Tab> complete-query

#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 +81,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


Loading…
Cancel
Save