Browse Source

Merge branch 'master' of github.com:LukeSmithxyz/mutt-wizard

pull/891/head
Luke Smith 2 years ago
parent
commit
3fe9922ec3
6 changed files with 84 additions and 95 deletions
  1. +25
    -33
      README.md
  2. +22
    -16
      bin/mailsync
  3. +26
    -34
      bin/mw
  4. +3
    -7
      mw.1
  5. +4
    -3
      share/domains.csv
  6. +4
    -2
      share/mutt-wizard.muttrc

+ 25
- 33
README.md View File

@@ -1,5 +1,7 @@
# mutt-wizard # mutt-wizard


https://muttwizard.com/

Get this great stuff without effort: Get this great stuff without effort:


- A full-featured and autoconfigured email client on the terminal with neomutt - A full-featured and autoconfigured email client on the terminal with neomutt
@@ -57,7 +59,7 @@ A user of Arch-based distros can also install the current mutt-wizard release fr
- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell - `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 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 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.
with <kbd>ctrl-f</kbd>. Run `notmuch new` to process new mail.
- `abook` - a terminal-based address book. Pressing tab while typing an address - `abook` - a terminal-based address book. Pressing tab while typing an address
to send mail to will suggest contacts that are in your abook. to send mail to will suggest contacts that are in your abook.
- `urlview` - outputs urls in mail to browser. - `urlview` - outputs urls in mail to browser.
@@ -99,34 +101,34 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use


#### General Settings #### General Settings


- `-p` -- Add a Protonmail account.
- `-f` -- Assume mailbox names and force account configuration without - `-f` -- Assume mailbox names and force account configuration without
connecting online at all. connecting online at all.
- `-o` -- Configure mutt for an account, but do not keep mail offline. - `-o` -- Configure mutt for an account, but do not keep mail offline.
- `-P` -- Use POP protocol instead of IMAP (requires `mpop` installed).
- `-p` -- Use POP protocol instead of IMAP (requires `mpop` installed).


## Neomutt user interface ## Neomutt user interface


To give you an example of the interface, here's an idea: 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
- <kbd>m</kbd> - send mail (uses your default `$EDITOR` to write)
- <kbd>j</kbd>/<kbd>k</kbd> and <kbd>d</kbd>/<kbd>u</kbd> - vim-like bindings to go down and up (or <kbd>d</kbd>/<kbd>u</kbd> to go
down/up a page). down/up a page).
- `l` - open mail, or attachment page or attachment
- `h` - the opposite of `l`
- `r`/`R` - reply/reply all to highlighted mail
- `s` - save selected mail or selected attachment
- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change
mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc.
- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox
letters above, i.e. `MS` means "move to Spam".
- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you
- <kbd>l</kbd> - open mail, or attachment page or attachment
- <kbd>h</kbd> - the opposite of <kbd>l</kbd>
- <kbd>r</kbd>/<kbd>R</kbd> - reply/reply all to highlighted mail
- <kbd>s</kbd> - save selected mail or selected attachment
- <kbd>gs</kbd>,<kbd>gi</kbd>,<kbd>ga</kbd>,<kbd>gd</kbd>,<kbd>gS</kbd> - Press <kbd>g</kbd> followed by another letter to change
mailbox: <kbd>s</kbd>ent, <kbd>i</kbd>nbox, <kbd>a</kbd>rchive, <kbd>d</kbd>rafts, <kbd>S</kbd>pam, etc.
- <kbd>M</kbd> and <kbd>C</kbd> - For <kbd>M</kbd>ove and <kbd>C</kbd>opy: follow them with one of the mailbox
letters above, i.e. <kbd>MS</kbd> means "move to Spam".
- <kbd>i#</kbd> - Press <kbd>i</kbd> followed by a number 1-9 to go to a different account. If you
add 9 accounts via mutt-wizard, they will each be assigned a number. 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
- <kbd>a</kbd> to add address/person to abook and <kbd>Tab</kbd> while typing address to complete
one from abook. one from abook.
- `?` - 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 your browser.
- <kbd>?</kbd> - see all keyboard shortcuts
- <kbd>ctrl-j</kbd>/<kbd>ctrl-k</kbd> - move up and down in sidebar, <kbd>ctrl-o</kbd> opens mailbox.
- <kbd>ctrl-b</kbd> - open a menu to select a URL you want to open in your browser.
- <kbd>p</kbd> - encrypt/sign your message (in compose view, before sending the email).


## Additional functionality ## Additional functionality


@@ -137,7 +139,7 @@ To give you an example of the interface, here's an idea:
- `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it - `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 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 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.
with <kbd>ctrl-f</kbd>. Run `notmuch new` to process new mail.
- `abook` - A terminal-based address book. Pressing tab while typing an address - `abook` - A terminal-based address book. Pressing tab while typing an address
to send mail to will suggest contacts that are in your abook. to send mail to will suggest contacts that are in your abook.
- `urlview` - Outputs URLs in an email to your browser. - `urlview` - Outputs URLs in an email to your browser.
@@ -167,7 +169,7 @@ To give you an example of the interface, here's an idea:
errors generally. errors generally.
- Addition of a manual `man mw` - Addition of a manual `man mw`
- Now handles POP protocol via `mpop` for those who prefer it (add an account - Now handles POP protocol via `mpop` for those who prefer it (add an account
with the `-P` option). POP configs are still generated automatically.
with the `-p` option). POP configs are still generated automatically.


## Help the Project! ## Help the Project!


@@ -176,10 +178,9 @@ To give you an example of the interface, here's an idea:
errors. errors.
- Open a PR to add new server information into `domains.csv` so their users can - Open a PR to add new server information into `domains.csv` so their users can
more easily use mutt-wizard. 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).
- If nothing else, donate:
- XMR: `8AzeWXhJvYJ1VeENHcNXCR1dLMgDALreZ1BdooZVjRKndv6myr3t1ue6C4ML2an5fWSpcP1sTDA9nKUMevkukDXG6chRjNv`
- BTC: `bc1qacqfp36ffv9mafechmvk8f6r8qy4tual6rcm9p`


## Details for Tinkerers ## Details for Tinkerers


@@ -204,15 +205,6 @@ See Luke's website [here](https://lukesmith.xyz). Email him at
applications requires turning off two-factor authentication and this will applications requires turning off two-factor authentication and this will
circumvent that. You might also need to manually "Enable IMAP" in the circumvent that. You might also need to manually "Enable IMAP" in the
settings. settings.
- Protonmail accounts require a "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 - 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. 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. Some, for example, will want you to create a separate IMAP password, etc.


+ 22
- 16
bin/mailsync View File

@@ -11,8 +11,6 @@
# issues. It also should at least be compatible with Linux (and maybe BSD) with # issues. It also should at least be compatible with Linux (and maybe BSD) with
# Xorg and MacOS as well. # Xorg and MacOS as well.


# Run only if user logged in (prevent cron errors)
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
# Run only if not already running in other instance # Run only if not already running in other instance
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}


@@ -21,7 +19,7 @@ pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}
# files for variable assignments. This is ugly, but there are few options that # files for variable assignments. This is ugly, but there are few options that
# will work on the maximum number of machines. # will work on the maximum number of machines.
eval "$(grep -h -- \ eval "$(grep -h -- \
"^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
"^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
"$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
"$HOME/.pam_environment" 2>/dev/null)" "$HOME/.pam_environment" 2>/dev/null)"
@@ -29,6 +27,7 @@ eval "$(grep -h -- \
export GPG_TTY="$(tty)" export GPG_TTY="$(tty)"


[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"
[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config"


lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun"


@@ -42,7 +41,7 @@ case "$(uname)" in
*systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
esac esac
# remember if a display server is running since `ps` doesn't always contain a display # remember if a display server is running since `ps` doesn't always contain a display
pgrepoutput="$(pgrep -a X\(org\|wayland\))"
pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))"
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
export DISPLAY=$x export DISPLAY=$x
@@ -54,14 +53,16 @@ esac
# Check account for new mail. Notify if there is new content. # Check account for new mail. Notify if there is new content.
syncandnotify() { syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")" acc="$(echo "$account" | sed "s/.*\///")"
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
if [ "$1" = "pop" ]; then
# Handle POP
mpop "$acc"
else
# Handle IMAP
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
fi
new=$(find\ new=$(find\
"$HOME/.local/share/mail/$acc/INBOX/new/"\
"$HOME/.local/share/mail/$acc/Inbox/new/"\
"$HOME/.local/share/mail/$acc/inbox/new/"\
"$HOME/.local/share/mail/$acc/INBOX/cur/"\
"$HOME/.local/share/mail/$acc/Inbox/cur/"\
"$HOME/.local/share/mail/$acc/inbox/cur/"\
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/new/\
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/cur/\
-type f -newer "$lastrun" 2> /dev/null) -type f -newer "$lastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
case 1 in case 1 in
@@ -70,23 +71,28 @@ syncandnotify() {
} }


# Sync accounts passed as argument or all. # Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
else
if [ "$#" -gt "0" ]; then
for arg in "$@"; do for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
done done
accounts=$* accounts=$*
fi fi
# TODO handle account passed from argument
[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
[ -z "$pop_accounts" ] && pop_accounts="$(awk '/^account/ {print $2}' "$MPOPRC")"


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

for account in $pop_accounts; do
syncandnotify "pop" &
done done


wait wait


notmuch new 2>/dev/null
notmuch new --quiet


#Create a touch file that indicates the time of the last run of mailsync #Create a touch file that indicates the time of the last run of mailsync
touch "$lastrun" touch "$lastrun"

+ 26
- 34
bin/mw View File

@@ -7,14 +7,13 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard"
muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc"
accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts"
msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config"
msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log"
msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/msmtp/msmtp.log"
mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}"
mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config"
alias mbsync='mbsync -c "$mbsyncrc"' alias mbsync='mbsync -c "$mbsyncrc"'


# On Ubuntu/Debian, a link is needed since they use an older version. # On Ubuntu/Debian, a link is needed since they use an older version.
if command -V apt-get >/dev/null 2>&1; then if command -V apt-get >/dev/null 2>&1; then
ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
master="Master" master="Master"
slave="Slave" slave="Slave"
fi fi
@@ -38,12 +37,14 @@ getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*


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


prepmsmtp() { echo "account $fulladdr
prepmsmtp() { mkdir -p "${msmtprc%/*}" "${msmtplog%/*}"
ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
echo "account $fulladdr
host $smtp host $smtp
port ${sport:-465} port ${sport:-465}
from $fulladdr from $fulladdr
user $login user $login
passwordeval \"pass $fulladdr\"
passwordeval \"pass $passprefix$fulladdr\"
auth ${auth:-on} auth ${auth:-on}
tls on tls on
tls_trust_file $sslcert tls_trust_file $sslcert
@@ -58,7 +59,7 @@ IMAPStore $fulladdr-remote
Host $imap Host $imap
Port ${iport:-993} Port ${iport:-993}
User $login User $login
PassCmd \"pass $fulladdr\"
PassCmd \"pass $passprefix$fulladdr\"
AuthMechs LOGIN AuthMechs LOGIN
SSLType ${imapssl:-IMAPS} SSLType ${imapssl:-IMAPS}
CertificateFile $sslcert CertificateFile $sslcert
@@ -87,10 +88,11 @@ tls on
user $login user $login
host $imap host $imap
delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX}
passwordeval pass $fulladdr
passwordeval pass $passprefix$fulladdr
" >> "$mpoprc" ;} " >> "$mpoprc" ;}


prepmutt() { echo "# vim: filetype=neomuttrc
prepmutt() { mkdir -p "${muttrc%/*}" "$accdir"
echo "# vim: filetype=neomuttrc
# muttrc file for account $fulladdr # muttrc file for account $fulladdr
set realname = \"$realname\" set realname = \"$realname\"
set from = \"$fulladdr\" set from = \"$fulladdr\"
@@ -119,8 +121,6 @@ macro index \eh \"<pipe-message>$prefix/libexec/gpg-wks-client --receive | msmtp
} }


getprofiles() { \ getprofiles() { \
mkdir -p "${muttrc%/*}" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp"
unset msmtp_header msmtp_profile mutt_profile mbsync_profile
case "$iport" in case "$iport" in
1143) imapssl=None ;; 1143) imapssl=None ;;
143) imapssl=STARTTLS ;; 143) imapssl=STARTTLS ;;
@@ -128,7 +128,7 @@ getprofiles() { \
case "$type" in case "$type" in
online) folder="imaps://$login@$imap:${iport:-993}" online) folder="imaps://$login@$imap:${iport:-993}"
extra="set imap_user = \"$login\" extra="set imap_user = \"$login\"
set imap_pass = \"\`pass $fulladdr\`\"
set imap_pass = \"\`pass $passprefix$fulladdr\`\"
set ssl_starttls = yes set ssl_starttls = yes
set ssl_force_tls = yes" set ssl_force_tls = yes"
;; ;;
@@ -176,7 +176,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then
sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu
sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu
sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu
pass rm -f "$fulladdr" >/dev/null 2>&1
pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
[ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}"


for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do
@@ -200,6 +200,7 @@ askinfo() { \
read -r smtp read -r smtp
[ "$sport" = 587 ] && tlsline="# tls_starttls" [ "$sport" = 587 ] && tlsline="# tls_starttls"
[ -z "$realname" ] && realname="${fulladdr%%@*}" [ -z "$realname" ] && realname="${fulladdr%%@*}"
[ -z "$passprefix" ] && passprefix=""
hostname="${fulladdr#*@}" hostname="${fulladdr#*@}"
login="${login:-$fulladdr}" login="${login:-$fulladdr}"
if [ -n "${password+x}" ]; then if [ -n "${password+x}" ]; then
@@ -209,22 +210,22 @@ askinfo() { \
fi fi
} }


createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr"
"$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$fulladdr"
rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;}
createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
"$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;}


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


getboxes() { if [ -n "${force+x}" ] ; then getboxes() { if [ -n "${force+x}" ] ; then
mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")"
else else
info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
[ -z "$info" ] && echo "Log-on not successful." && return 1 [ -z "$info" ] && echo "Log-on not successful." && return 1
mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
fi fi
[ "$type" = "pop" ] && mailboxes="INBOX" [ "$type" = "pop" ] && mailboxes="INBOX"
for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" | sort -u; echo 0); do
for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u; echo 0); do
idnum=$((idnum + 1)) idnum=$((idnum + 1))
[ "$idnum" -eq "$x" ] || break [ "$idnum" -eq "$x" ] || break
done done
@@ -262,7 +263,7 @@ togglecron() { cron="$(mktemp)"
sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu
else else
echo "Adding automatic mailsync every ${cronmin:-10} minutes..." echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
echo "*/${cronmin-10} * * * * $prefix/bin/mailsync" >> "$cron"
echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync -q" >> "$cron"
fi && fi &&
crontab "$cron"; rm -f "$cron" ;} crontab "$cron"; rm -f "$cron" ;}


@@ -297,8 +298,8 @@ Options allowed with -a:
-s SMTP server address -s SMTP server address
-S SMTP server port -S SMTP server port
-x Password for account (recommended to be in double quotes) -x Password for account (recommended to be in double quotes)
-p Install for a Protonmail account.
-P Add for a POP server instead of IMAP.
-P Pass Prefix (prefix of the file where password is stored)
-p Add for a POP server instead of IMAP.
-X Delete an account's local email too when deleting. -X Delete an account's local email too when deleting.
-o Configure address, but keep mail online. -o Configure address, but keep mail online.
-f Assume typical English mailboxes without attempting log-on. -f Assume typical English mailboxes without attempting log-on.
@@ -306,7 +307,7 @@ Options allowed with -a:
NOTE: Once at least one account is added, you can run NOTE: Once at least one account is added, you can run
\`mbsync -a\` to begin downloading mail. \`mbsync -a\` to begin downloading mail.


To change an account's password, run \`pass edit your@email.com\`.
To change an account's password, run \`pass edit '$passprefix'your@email.com\`.
EOF EOF
} }


@@ -333,7 +334,7 @@ reorder() {
' "$tempfile" >> "$muttrc" ' "$tempfile" >> "$muttrc"
} }


while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in
l) setact list || exit 1 ;; l) setact list || exit 1 ;;
r) setact reorder || exit 1 ;; r) setact reorder || exit 1 ;;
d) setact delete || exit 1 ;; d) setact delete || exit 1 ;;
@@ -347,24 +348,15 @@ while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in
S) setact add || exit 1 ; sport="$OPTARG" ;; S) setact add || exit 1 ; sport="$OPTARG" ;;
u) setact add || exit 1 ; login="$OPTARG" ;; u) setact add || exit 1 ; login="$OPTARG" ;;
n) setact add || exit 1 ; realname="$OPTARG" ;; n) setact add || exit 1 ; realname="$OPTARG" ;;
P) setact add || exit 1 ; passprefix="$OPTARG" ;;
m) setact add || exit 1 ; maxmes="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;;
o) setact add || exit 1 ; type="online" ;; o) setact add || exit 1 ; type="online" ;;
P) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;;
p) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;;
f) setact add || exit 1 ; force=True ;; f) setact add || exit 1 ; force=True ;;
x) setact add || exit 1 ; password="$OPTARG" ;; x) setact add || exit 1 ; password="$OPTARG" ;;
X) setact delete || exit 1 ; purge=True ;; X) setact delete || exit 1 ; purge=True ;;
t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; t) setact toggle || exit 1 ; cronmin="$OPTARG" ;;
T) setact toggle || exit 1 ;; T) setact toggle || exit 1 ;;
p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work."
protocol="imap"
imap="127.0.0.1"
iport="1143"
smtp="127.0.0.1"
sport="1025"
auth="login"
tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | sed -n '/SHA256:/ s/^\s*SHA256:\s*// p')"
setact add || exit 1
;;
*) mwinfo; exit 1 ;; *) mwinfo; exit 1 ;;
esac done esac done




+ 3
- 7
mw.1 View File

@@ -70,6 +70,8 @@ SMTP server port (assumed to be 465 if not specified)
.TP .TP
.B -x .B -x
Account password. You will be prompted for the password interactively if this option is not given. Account password. You will be prompted for the password interactively if this option is not given.
.B -P
Pass Prefix. The password will be stored using pass at <passprefix><email>
.SH OTHER OPTIONS .SH OTHER OPTIONS
.TP .TP
.B -f .B -f
@@ -80,9 +82,6 @@ Create settings for an account to be used online only without mail syncing abili
.B -f .B -f
connection will still be attempted in setup to discover mailboxes. connection will still be attempted in setup to discover mailboxes.
.TP .TP
.B -p
Add a Protonmail account. Protonmail Bridge must be installed and set up.
.TP
.B -X .B -X
When removing an email profile with either When removing an email profile with either
.I -d .I -d
@@ -90,7 +89,7 @@ or
.I -D, .I -D,
also delete the local mail (will not delete the mail on the server). also delete the local mail (will not delete the mail on the server).
.TP .TP
.B -P
.B -p
Use POP protocol instead of IMAP. Requires Use POP protocol instead of IMAP. Requires
.I mpop .I mpop
to download mail after configuration. Server details can still be given with the to download mail after configuration. Server details can still be given with the
@@ -155,9 +154,6 @@ on mutt-wizard's Github <https://github.com/lukesmithxyz/mutt-wizard> or Gitlab
.B Gmail accounts .B Gmail accounts
Google will require you to allow "less-secure" (third party) applications or remove two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard <https://support.google.com/accounts/answer/6010255>. Google will require you to allow "less-secure" (third party) applications or remove two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard <https://support.google.com/accounts/answer/6010255>.
.TP .TP
.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.
.TP
.B Enterprise and university accounts .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. Many universities and businesses might host their domain's email via Google or another service. This often requires a special IMAP/SMTP-specific password that you must generate and use. Again, mutt-wizard can handle these systems, but only once they've been set up.
.TP .TP


+ 4
- 3
share/domains.csv View File

@@ -33,6 +33,7 @@ autograf.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465
autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465 autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465
bartender.net,imap.mail.com,993,smtp.mail.com,587 bartender.net,imap.mail.com,993,smtp.mail.com,587
bastardi.net,mail.autistici.org,993,smtp.autistici.org,465 bastardi.net,mail.autistici.org,993,smtp.autistici.org,465
beaumccartney.xyz,mail.beaumccartney.xyz,993,mail.beaumccartney.xyz,465
bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587
bigpond.com,imap.telstra.com,143,smtp.telstra.com,587 bigpond.com,imap.telstra.com,143,smtp.telstra.com,587
bikerider.com,imap.mail.com,993,smtp.mail.com,587 bikerider.com,imap.mail.com,993,smtp.mail.com,587
@@ -107,6 +108,7 @@ fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587
firemail.cc,mail.cock.li,993,mail.cock.li,587 firemail.cc,mail.cock.li,993,mail.cock.li,587
forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465 forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465
forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465 forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465
freedom.nl,imap.freedom.nl,993,smtp.freedom.nl,465
freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465 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 fsu-jena,exchange.uni-jena.de,993,smtp.uni-jena.de,587
@@ -216,7 +218,6 @@ parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587
paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465
paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25 paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25
paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587
pm.me,127.0.0.1,1143,127.0.0.1,1025
poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465
poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.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 polimi.it,outlook.office365.com,993,smtp.office365.com,587
@@ -226,8 +227,7 @@ posteo.*,posteo.de,993,posteo.de,587
privacy.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 privacy.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465
prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465
protonmail.ch,127.0.0.1,1143,127.0.0.1,1025
protonmail.com,127.0.0.1,1143,127.0.0.1,1025
purelymail.com,imap.purelymail.com,993,smtp.purelymail.com,465
pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587 pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587
qq.com,imap.qq.com,993,smtp.qq.com,587 qq.com,imap.qq.com,993,smtp.qq.com,587
rape.lol,mail.cock.li,993,mail.cock.li,587 rape.lol,mail.cock.li,993,mail.cock.li,587
@@ -294,6 +294,7 @@ uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587
ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587
ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587
ukr.net,imap.ukr.net,993,smtp.ukr.net,465 ukr.net,imap.ukr.net,993,smtp.ukr.net,465
umbc.edu,imap.gmail.com,993,smtp.gmail.com,587
uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465
uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587
uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587 uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587


+ 4
- 2
share/mutt-wizard.muttrc View File

@@ -58,8 +58,10 @@ bind index,query <space> tag-entry
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder"
bind index,pager H view-raw-message bind index,pager H view-raw-message
bind browser l select-entry bind browser l select-entry
bind pager,browser gg top-page
bind pager,browser G bottom-page
bind browser gg top-page
bind browser G bottom-page
bind pager gg top
bind pager G bottom
bind index,pager,browser d half-down bind index,pager,browser d half-down
bind index,pager,browser u half-up bind index,pager,browser u half-up
bind index,pager S sync-mailbox bind index,pager S sync-mailbox


Loading…
Cancel
Save