summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2025-02-28 09:48:14 +0000
committerGitHub <noreply@github.com>2025-02-28 09:48:14 +0000
commit650794bb1d20c3f7e8d3dfc0fc9a7add8519c5f3 (patch)
treec913119400c8883ab0da4c17e915b913b3b46885
parent058fc42c215355379d7ed082b0e30acad20bda52 (diff)
parent05fcf7b3e113e8b3975e023217caf83007adbf01 (diff)
Merge branch 'master' into master
-rw-r--r--Makefile30
-rw-r--r--README.md8
-rwxr-xr-xbin/mailsync15
-rwxr-xr-xbin/mw331
-rw-r--r--mw.11
-rw-r--r--share/domains.csv7
-rw-r--r--share/mbsync-temp2
-rw-r--r--share/mutt-temp4
-rw-r--r--share/mutt-wizard.muttrc14
9 files changed, 255 insertions, 157 deletions
diff --git a/Makefile b/Makefile
index a150447..623aaf7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,39 +1,27 @@
.POSIX:
-OS = $(shell uname -s)
-ifndef PREFIX
- PREFIX = /usr/local
-endif
-ifndef MANPREFIX
- MANPREFIX = $(PREFIX)/share/man
-endif
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard
- cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/
- cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
- chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
+ cp -f bin/mailsync $(DESTDIR)$(PREFIX)/bin
+ cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
for shared in share/*; do \
cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \
done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
- cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
+ sed 's:/usr/local:$(PREFIX):' < share/mutt-wizard.muttrc > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc
+ sed 's:/usr/local:$(PREFIX):' < share/mailcap > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap
+ sed 's:/usr/local:$(PREFIX):' < bin/mw > $(DESTDIR)$(PREFIX)/bin/mw
+ sed 's:/usr/local:$(PREFIX):' < mw.1 > $(DESTDIR)$(MANPREFIX)/man1/mw.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
- if [ "$(PREFIX)" ]; then \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \
- rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \
- rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \
- rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \
- rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \
- fi
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
chmod 755 $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
cp -f completion/_mutt-wizard.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_mutt-wizard.zsh
diff --git a/README.md b/README.md
index 5c3043a..ba0517e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ https://muttwizard.com/
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 wibuiltth neomutt
- Mail stored offline enabling the ability to:
* view and write emails while you're away from
the internet
@@ -36,7 +36,7 @@ Specifically, this wizard:
- `msmtp` - sends the email.
- `pass` - safely encrypts passwords (required at install).
- `ca-certificates` - required for SSL. Probably installed already.
-- `goimapnotify` - required for push notifications. [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
+- `gettext` - writes config files. Probably installed already.
**Note**: There's a chance of errors if you use a slow-release distro like
Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most
@@ -54,6 +54,8 @@ A user of Arch-based distros can also install the current mutt-wizard release fr
### Optional Dependencies
+- `goimapnotify` - required for push notifications.
+ [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
- `pam-gnupg` - Automatically logs you into your GPG key on login so you will
never need to input your password once logged on to your system. Check the
repo and directions out [here](https://github.com/cruegge/pam-gnupg).
@@ -215,6 +217,8 @@ systemctl enable --user goimapnotify@fulladdrs.service
applications requires turning off two-factor authentication and this will
circumvent that. You might also need to manually "Enable IMAP" in the
settings.
+ To create an App Password for your Google account,
+ you can directly visit the [App Passwords](https://myaccount.google.com/apppasswords) page in your Google Account settings.
- If you have a university email or enterprise-hosted email for work, there
might be other hurdles or two-factor authentication you have to jump through.
Some, for example, will want you to create a separate IMAP password, etc.
diff --git a/bin/mailsync b/bin/mailsync
index cbd36ff..1407e7c 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -45,7 +45,7 @@ case "$(uname)" in
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
export DISPLAY="$x"
- notify-send --app-name="mutt-wizard" "$1" "$2"
+ notify-send --app-name="mutt-wizard" -- "$1" "$2"
done ;}
;;
esac
@@ -63,16 +63,17 @@ syncandnotify() {
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
case 1 in
$((newcount > 5)) )
- echo "$newcount new mail for $2."
- [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account."
+ echo "$newcount new mails for $2." >/dev/tty
+ [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account."
;;
$((newcount > 0)) )
- echo "$newcount new mail for $2."
+ echo "$newcount new mail(s) for $2." >/dev/tty
[ -z "$MAILSYNC_MUTE" ] &&
for file in $new; do
- # Extract and decode subject and sender from mail.
- subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" |
- perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
+ # Extract and decode subject and sender from mail.
+ subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 |
+ perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
+ sed 's/^Subject: //' | tr -d '\n\t')
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"
diff --git a/bin/mw b/bin/mw
index ab9c36d..5503e88 100755
--- a/bin/mw
+++ b/bin/mw
@@ -9,10 +9,10 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard"
muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc"
accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts"
msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config"
-msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/msmtp/msmtp.log"
+msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log"
mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}"
mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config"
-imapnotify="${XDG_CONFIG_HOME:$HOME/.config}/imapnotify"
+imapnotify="${XDG_CONFIG_HOME:-$HOME/.config}/imapnotify"
mpoptemp="$muttshare/mpop-temp"
mbsynctemp="$muttshare/mbsync-temp"
mutttemp="$muttshare/mutt-temp"
@@ -47,57 +47,76 @@ for x in "/etc/ssl/certs/ca-certificates.crt" \
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \
"/usr/local/share/ca-certificates/"; do
[ -f "$x" ] && sslcert="$x" && break
-done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;}
+done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1; }
-checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
+checkbasics() {
+ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || {
- echo "First run \`pass init <yourgpgemail>\` to set up a password archive."
- echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)"
- exit 1 ;} ;}
+ echo "First run \`pass init <yourgpgemail>\` to set up a password archive."
+ echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)"
+ exit 1
+ }
+}
-getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)" ;}
+getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)"; }
-list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;}
+list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1; }
-prepmsmtp() { mkdir -p "${msmtprc%/*}" "${msmtplog%/*}" ; ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null ; envsubst < "$msmtptemp" >> "$msmtprc" ;}
+prepmsmtp() {
+ mkdir -p "${msmtprc%/*}" "${msmtplog%/*}"
+ ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
+ envsubst <"$msmtptemp" >>"$msmtprc"
+}
-prepmbsync() { mkdir -p "${mbsyncrc%/*}" ; [ -f "$mbsyncrc" ] && echo >> "$mbsyncrc" ; envsubst < "$mbsynctemp" >> "$mbsyncrc" ;}
+prepmbsync() {
+ mkdir -p "${mbsyncrc%/*}"
+ [ -f "$mbsyncrc" ] && echo >>"$mbsyncrc"
+ envsubst <"$mbsynctemp" >>"$mbsyncrc"
+}
-prepmpop() { mkdir -p "${mpoprc%/*}" ; envsubst < "$mpoptemp" >> "$mpoprc" ;}
+prepmpop() {
+ mkdir -p "${mpoprc%/*}"
+ envsubst <"$mpoptemp" >>"$mpoprc"
+}
-prepimapnotify() { mkdir -p "${imapnotify%/*}" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf" ;}
+prepimapnotify() {
+ mkdir -p "${imapnotify%/*}" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf"
+}
-prepmutt() { mkdir -p "${muttrc%/*}" "$accdir"
- envsubst < "$mutttemp" > "$accdir/$fulladdr.muttrc"
- [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc"
- ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >> "$muttrc"
- ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >> "$muttrc"
- echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >> "$muttrc"
+prepmutt() {
+ mkdir -p "${muttrc%/*}" "$accdir"
+ envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc"
+ [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" >"$muttrc"
+ ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc"
+ ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc"
+ echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$muttrc"
}
-getprofiles() { \
+getprofiles() {
safename="$(echo $fulladdr | sed 's/@/_/g')"
case "$type" in
- online)
- folder="imaps://$login@$imap:$iport"
- extra="$(envsubst < "$onlinetemp")"
- ;;
- pop) prepmpop ;;
- *)
+ online)
+ folder="imaps://$login@$imap:$iport"
+ extra="$(envsubst <"$onlinetemp")"
+ ;;
+ pop) prepmpop ;;
+ *)
case "$iport" in
- 1143) imapssl=None ;;
- 143) imapssl=STARTTLS ;;
+ 1143) imapssl=None ;;
+ 143) imapssl=STARTTLS ;;
esac
- prepmbsync ;;
+ prepmbsync
+ ;;
esac
prepmsmtp
prepmutt
prepnotmuch
- prepimapnotify
+ prepimapnotify
}
-parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
+parsedomains() {
+ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
[ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)"
@@ -110,7 +129,8 @@ EOF
iport="${iport:-$iportsugg}"
}
-delete() { if [ -z "${fulladdr+x}" ]; then
+delete() {
+ if [ -z "${fulladdr+x}" ]; then
echo "Select the account you would like to delete (by number):"
list || exit 1
read -r input
@@ -124,16 +144,20 @@ delete() { if [ -z "${fulladdr+x}" ]; then
[ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1
- sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null ; rm -f "$mbsyncrc"bu
- rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc"
- sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu
- sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu
- sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu
+ sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null
+ rm -f "$mbsyncrc"bu
+ rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc"
+ sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null
+ rm -f "$muttrc"bu
+ sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null
+ rm -f "$msmtprc"bu
+ sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null
+ rm -f "$mpoprc"bu
pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
[ -n "${purge+x}" ] && safename="$(echo $fulladdr | sed 's/@/_/g')" && rm -rf "${cachedir:?}/${safename:?}" "${maildir:?}/${fulladdr:?}"
}
-askinfo() { \
+askinfo() {
[ -z "$fulladdr" ] && echo "Give the full email address to add:" &&
read -r fulladdr
while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do
@@ -141,54 +165,54 @@ askinfo() { \
read -r fulladdr
done
folder="$maildir/$fulladdr"
- getaccounts; echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null &&
- { echo "$fulladdr has already been added" && exit 1 ;}
- { [ -z "$imap" ] || [ -z "$smtp" ] ;} && parsedomains
+ getaccounts
+ echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null &&
+ { echo "$fulladdr has already been added" && exit 1; }
+ { [ -z "$imap" ] || [ -z "$smtp" ]; } && parsedomains
[ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" &&
read -r imap
[ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" &&
read -r smtp
case $sport in
- 587) tlsline="# tls_starttls" ;;
+ 587) tlsline="# tls_starttls" ;;
esac
[ -z "$realname" ] && realname="${fulladdr%%@*}"
[ -z "$passprefix" ] && passprefix=""
hostname="${fulladdr#*@}"
login="${login:-$fulladdr}"
- if [ -n "${password+x}" ]; then
- createpass
- else
+ if [ -n "${password+x}" ] && [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
+ insertpass
+ elif [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
getpass
- fi
+ fi
}
-createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
- "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
- case "$(uname)" in
- Darwin|*BSD) rm -P "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;;
- *) shred -u "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;;
- esac
- rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;}
+insertpass() {
+ printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
+}
errorexit() {
echo "Log-on not successful."
case "$imap" in
- imap.gmail.com)
- echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password.
+ imap.gmail.com)
+ echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password.
Please be sure you are using OAUTH with your Gmail account, or better yet, stop using Gmail."
- ;;
- imap.mail.me.com)
- echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default.
+ ;;
+ imap.mail.me.com)
+ echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default.
Please be sure you either enable third-party applications, or create an app-specific password, or best of all, stop using Apple."
- ;;
+ ;;
esac
exit 1
- }
+}
-getpass() { while : ; do pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
- pass insert -f "$passprefix$fulladdr" && break; done ;}
+getpass() { while :; do
+ pass rm -f "$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")"
else
info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
@@ -196,45 +220,56 @@ getboxes() { if [ -n "${force+x}" ] ; then
mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
fi
[ "$type" = "pop" ] && mailboxes="INBOX"
- for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u; echo 0); do
+ for x in $(
+ sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u
+ echo 0
+ ); do
idnum=$((idnum + 1))
[ "$idnum" -eq "$x" ] || break
done
- toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' - )"
+ toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)"
}
-finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc"
+finalize() {
+ echo "$toappend" >>"$accdir/$fulladdr.muttrc"
[ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new"
mkdir -p "$cachedir/$safename/bodies"
echo "$fulladdr (account #$idnum) added successfully."
- command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview"
- return 0 ;}
+ command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" >"$HOME/.urlview"
+ return 0
+}
-prepnotmuch() { \
+prepnotmuch() {
[ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
[ -f "$NOTMUCH_CONFIG" ] && return 0
- envsubst < "$notmuchtemp" > "$NOTMUCH_CONFIG" ;}
+ envsubst <"$notmuchtemp" >"$NOTMUCH_CONFIG"
+}
-togglecron() { cron="$(mktemp)"
- crontab -l > "$cron"
+togglecron() {
+ cron="$(mktemp)"
+ crontab -l >"$cron"
if grep -q mailsync "$cron"; then
echo "Removing automatic mailsync..."
- sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu
+ sed -ibu /mailsync/d "$cron"
+ rm -f "$cron"bu
else
echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
- echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >> "$cron"
+ echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >>"$cron"
fi &&
- crontab "$cron"; rm -f "$cron" ;}
+ crontab "$cron"
+ rm -f "$cron"
+}
setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then
- echo "Running $1 with $action..."
- echo "Incompatible options given. Only one action may be specified per run."
- exit 1
- else
- action="$1"
- fi; }
+ echo "Running $1 with $action..."
+ echo "Incompatible options given. Only one action may be specified per run."
+ exit 1
+else
+ action="$1"
+fi; }
-mwinfo() { cat << EOF
+mwinfo() {
+ cat <<EOF
mw: mutt-wizard, auto-configure email accounts for mutt
including downloadable mail with \`isync\`.
@@ -271,64 +306,124 @@ EOF
reorder() {
tempfile="$(mktemp -u)"
trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT
- echo "# Carefully reorder these accounts with the desired numbers in the first column.
-# DO NOT reorder rows or rename the accounts in the second column." > "$tempfile"
+ echo "# Carefully reorder these accounts with the desired numbers in the first column.
+# DO NOT reorder rows or rename the accounts in the second column." >"$tempfile"
sed -n "
/ i[0-9] / s?\(.* i\|'<sync.*/\|\.muttrc.*\)??g p
- " "$muttrc" >> "$tempfile"
+ " "$muttrc" >>"$tempfile"
${EDITOR:-vim} "$tempfile" || exit 1
- sed -i -e 's/#.*//' -e '/^$/d' "$tempfile"
+ sed -i -e 's/#.*//' -e '/^$/d' "$tempfile"
default="$(sort -n "$tempfile" | head -n 1)"
default="${default#* }"
sed -ibu "
/.* i[0-9] .*.muttrc/d
/^source.*accounts.*.muttrc/d
- " "$muttrc" 2>/dev/null; rm -f "$muttrc"bu
+ " "$muttrc" 2>/dev/null
+ rm -f "$muttrc"bu
awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" }
{
print "macro index,pager i"$1" '\''<sync-mailbox><enter-command>source "a"/"$2".muttrc<enter><change-folder>!<enter>;<check-stats>'\'' \"switch to "$2"\""
}
- ' "$tempfile" >> "$muttrc"
+ ' "$tempfile" >>"$muttrc"
}
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in
l) setact list ;;
- r) setact reorder1 ;;
+ r) setact reorder ;;
d) setact delete ;;
- D) setact delete ; fulladdr="$OPTARG" ;;
- y) setact sync ; fulladdr="$OPTARG" ;;
+ D)
+ setact delete
+ fulladdr="$OPTARG"
+ ;;
+ y)
+ setact sync
+ fulladdr="$OPTARG"
+ ;;
Y) setact sync ;;
- a) setact add ; fulladdr="$OPTARG" ;;
- i) setact add ; imap="$OPTARG" ;;
- I) setact add ; iport="$OPTARG" ;;
- s) setact add ; smtp="$OPTARG" ;;
- S) setact add ; sport="$OPTARG" ;;
- u) setact add ; login="$OPTARG" ;;
- n) setact add ; realname="$OPTARG" ;;
- P) setact add ; passprefix="$OPTARG" ;;
- m) setact add ; maxmes="$OPTARG" ;;
- o) setact add ; type="online" ;;
- p) setact add ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;;
- f) setact add ; force=True ;;
- x) setact add ; password="$OPTARG" ;;
- X) setact delete ; purge=True ;;
- t) setact toggle ; cronmin="$OPTARG" ;;
+ a)
+ setact add
+ fulladdr="$OPTARG"
+ ;;
+ i)
+ setact add
+ imap="$OPTARG"
+ ;;
+ I)
+ setact add
+ iport="$OPTARG"
+ ;;
+ s)
+ setact add
+ smtp="$OPTARG"
+ ;;
+ S)
+ setact add
+ sport="$OPTARG"
+ ;;
+ u)
+ setact add
+ login="$OPTARG"
+ ;;
+ n)
+ setact add
+ realname="$OPTARG"
+ ;;
+ P)
+ setact add
+ passprefix="$OPTARG"
+ ;;
+ m)
+ setact add
+ maxmes="$OPTARG"
+ ;;
+ o)
+ setact add
+ type="online"
+ ;;
+ p)
+ setact add
+ type="pop"
+ protocol="pop3s"
+ iport="${iport:-995}"
+ ;;
+ f)
+ setact add
+ force=True
+ ;;
+ x)
+ setact add
+ password="$OPTARG"
+ ;;
+ X)
+ setact delete
+ purge=True
+ ;;
+ t)
+ setact toggle
+ cronmin="$OPTARG"
+ ;;
T) setact toggle ;;
h) setact info ;;
- \?) echo "See \`$(basename $0) -h\` for possible options and help."; exit 1 ;;
-esac done
+ \?)
+ echo "See \`$(basename $0) -h\` for possible options and help."
+ exit 1
+ ;;
+ esac done
[ -z "$action" ] && action="info"
case "$action" in
- list) list ;;
- add) checkbasics && askinfo && getboxes && getprofiles && finalize ;;
- delete) delete ;;
- sync)
- echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`."
- mailsync $fulladdr
- ;;
- toggle) togglecron ;;
- reorder) reorder ;;
- info) mwinfo; exit 1 ;;
+list) list ;;
+add) checkbasics && askinfo && getboxes && getprofiles && finalize ;;
+delete) delete ;;
+sync)
+ echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`."
+ mailsync $fulladdr
+ ;;
+toggle) togglecron ;;
+reorder) reorder ;;
+info)
+ mwinfo
+ exit 1
+ ;;
esac
diff --git a/mw.1 b/mw.1
index 4a136ee..f40db45 100644
--- a/mw.1
+++ b/mw.1
@@ -70,6 +70,7 @@ SMTP server port (assumed to be 465 if not specified)
.TP
.B -x
Account password. You will be prompted for the password interactively if this option is not given.
+.TP
.B -P
Pass Prefix. The password will be stored using pass at <passprefix><email>
.SH OTHER OPTIONS
diff --git a/share/domains.csv b/share/domains.csv
index eaa0be1..beb7a1e 100644
--- a/share/domains.csv
+++ b/share/domains.csv
@@ -53,6 +53,7 @@ carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587
cash4u.com,imap.mail.com,993,smtp.mail.com,587
cedars.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465
ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587
+cerex.no,mail.cerex.no,993,mail.cerex.no,465
cheerful.com,imap.mail.com,993,smtp.mail.com,587
chef.net,imap.mail.com,993,smtp.mail.com,587
chemist.com,imap.mail.com,993,smtp.mail.com,587
@@ -88,6 +89,7 @@ diplomats.com,imap.mail.com,993,smtp.mail.com,587
dismail.de,imap.dismail.de,993,smtp.dismail.de,465
disroot.org,disroot.org,993,disroot.org,587
distruzione.org,mail.autistici.org,993,smtp.autistici.org,465
+domeneshop.no,imap.domeneshop.no,993,smtp.domeneshop.no,587
dorriseaton.com,outlook.office365.com,993,smtp.office365.com,587
dr.com,imap.mail.com,993,smtp.mail.com,587
duke.edu,outlook.office365.com,993,smtp.office365.com,587
@@ -115,9 +117,10 @@ freedom.nl,imap.freedom.nl,993,smtp.freedom.nl,465
freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465
fsu-jena,exchange.uni-jena.de,993,smtp.uni-jena.de,587
+fz-juelich.de,imap.fz-juelich.de,993,mail.fz-juelich.de,587
gcc.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587
getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587
-ghalv.no,mail.ghalv.no,993,mail.ghalv.no,587
+ghalv.no,mail.ghalv.no,993,mail.ghalv.no,465
gmail.com,imap.gmail.com,993,smtp.gmail.com,587
gmx.*,imap.gmx.net,993,mail.gmx.net,587
go2.pl,poczta.o2.pl,993,poczta.o2.pl,465
@@ -198,7 +201,7 @@ national.shitposting.agency,mail.cock.li,993,mail.cock.li,587
ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587
netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465
nigge.rs,mail.cock.li,993,mail.cock.li,587
-niser.ac.in,imap.gmail.com,993,smtp.gmail.com,587
+niser.ac.in,imap.gmail.com,993,smtp.gmail.com,465
nixnet.email,imap.nixnet.email,143,smtp.nixnet.email,587
nixnet.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
nixnetmail.com,imap.nixnet.email,143,smtp.nixnet.email,587
diff --git a/share/mbsync-temp b/share/mbsync-temp
index 46cd51b..4e77b09 100644
--- a/share/mbsync-temp
+++ b/share/mbsync-temp
@@ -16,7 +16,7 @@ Channel $fulladdr
Expunge Both
$master :$fulladdr-remote:
$slave :$fulladdr-local:
-Patterns * !"[Gmail]/All Mail"
+Patterns * !"[Gmail]/All Mail" !"*fts-flatcurve*" !"*virtual*"
Create Both
SyncState *
MaxMessages $maxmes
diff --git a/share/mutt-temp b/share/mutt-temp
index 81148a1..63841ad 100644
--- a/share/mutt-temp
+++ b/share/mutt-temp
@@ -1,6 +1,6 @@
# vim: filetype=neomuttrc
# muttrc file for account $fulladdr
-set realname = "$realname"
+set real_name = "$realname"
set from = "$fulladdr"
set sendmail = "msmtp -a $fulladdr"
alias me $realname <$fulladdr>
@@ -10,7 +10,7 @@ set message_cachedir = "$cachedir/$safename/bodies"
set mbox_type = Maildir
set hostname = "$hostname"
source $muttshare/switch.muttrc
-set spoolfile = "+INBOX"
+set spool_file = "+INBOX"
set postponed = "+Drafts"
set trash = "+Trash"
set record = "+Sent"
diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc
index 47d48c3..f236bc4 100644
--- a/share/mutt-wizard.muttrc
+++ b/share/mutt-wizard.muttrc
@@ -15,7 +15,8 @@ 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 mime_forward = no # mail body is forwarded as text
+set forward_attachments = 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
@@ -90,7 +91,7 @@ macro index,pager ga "<change-folder>=Archive<enter>" "go to archive"
macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to archive"
macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to archive"
-#set crypt_autosign = yes
+#set crypt_auto_sign = yes
#set crypt_opportunistic_encrypt = yes
#set pgp_self_encrypt = yes
#set pgp_default_key = 'your@gpgemailaddre.ss'
@@ -99,8 +100,8 @@ macro index \eh "<pipe-message>$prefix/libexec/gpg-wks-client --receive | msmtp
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>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 O "<shell-escape>mailsync<enter>" "run mailsync 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 >\"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\"<enter><limit>~i \"\`notmuch search --output=messages \$(cat \"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\") | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/g for@a; s/\\$/\\\\\\$/g 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
@@ -133,6 +134,11 @@ color index brightyellow blue "~T"
color index_author brightred blue "~T"
color index_subject brightcyan blue "~T"
+# Flagged mail is highlighted:
+color index brightgreen default "~F"
+color index_subject brightgreen default "~F"
+color index_author brightgreen default "~F"
+
# Other colors and aesthetic settings:
mono bold bold
mono underline underline