summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile25
-rw-r--r--README.md11
-rwxr-xr-xbin/mailsync10
-rwxr-xr-xbin/mw19
-rwxr-xr-xbin/openfile3
-rw-r--r--share/domains.csv (renamed from domains.csv)16
-rw-r--r--share/mailcap (renamed from mailcap)0
-rw-r--r--share/mutt-wizard.muttrc (renamed from mutt-wizard.muttrc)0
8 files changed, 56 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 6a4ee2e..e4a1440 100644
--- a/Makefile
+++ b/Makefile
@@ -5,26 +5,21 @@ MANPREFIX = $(PREFIX)/share/man
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
- cp -f bin/mw $(DESTDIR)$(PREFIX)/bin
- chmod 755 $(DESTDIR)$(PREFIX)/bin/mw
- cp -f bin/openfile $(DESTDIR)$(PREFIX)/bin
- chmod 755 $(DESTDIR)$(PREFIX)/bin/openfile
- cp -f bin/muttimage $(DESTDIR)$(PREFIX)/bin
- chmod 755 $(DESTDIR)$(PREFIX)/bin/muttimage
- cp -f bin/mailsync $(DESTDIR)$(PREFIX)/bin
- chmod 755 $(DESTDIR)$(PREFIX)/bin/mailsync
+ for script in bin/*; do \
+ cp -f $$script $(DESTDIR)$(PREFIX)/bin/; \
+ chmod 755 $(DESTDIR)$(PREFIX)/$$script; \
+ done
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
+ for shared in share/*; do \
+ cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \
+ done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
- cp -f mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard
- cp -f mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
- cp -f domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
uninstall:
- rm -f $(DESTDIR)$(PREFIX)/bin/mw
- rm -f $(DESTDIR)$(PREFIX)/bin/mailsync
- rm -f $(DESTDIR)$(PREFIX)/bin/openfile
- rm -f $(DESTDIR)$(PREFIX)/bin/muttimage
+ for script in bin/*; do \
+ rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \
+ done
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard
.PHONY: install uninstall
diff --git a/README.md b/README.md
index f2b2516..bbfa588 100644
--- a/README.md
+++ b/README.md
@@ -109,7 +109,14 @@ mutt-wizard is free/libre software, licensed under the GPLv3.
## Watch out for these things:
-- For Gmail accounts, remember also to enable third-party ("""less secure""") applications before attempting installation.
+- For Gmail accounts, remember also to enable third-party ("""less secure""") applications before attempting installation. You might also need to manually "Enable IMAP" in the settings.
- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard.
- If you have a university email, or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc.
-- If you use an email server whose mailboxes are not in English, mutt-wizard might not be able to guess which is which, so you may have to manually set your Inbox, Sent, Trash, Drafts, etc. in your mutt config file. Do this after running the wizard in `accounts/NAME.muttrc`.
+ - `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
+- Out-of-the-box compatibility with Protonmail Bridge
+- Option to ignore `domains.csv` (for troubleshooting)
+- Option to keep configuration for accounts that failed to connect (maybe)
diff --git a/bin/mailsync b/bin/mailsync
index 620557c..8ae8758 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -1,6 +1,9 @@
#!/usr/bin/env sh
# Sync mail and give notification if there is new mail.
+# Run only if user logged in (prevent cron errors)
+w | grep "^$USER\W" >/dev/null || exit
+
# Checks for internet connection and set notification script.
ping -q -c 1 1.1.1.1 > /dev/null || 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."
@@ -18,7 +21,12 @@ echo " 🔃" > /tmp/imapsyncicon_$USER
pkill -RTMIN+12 i3blocks
# Run mbsync. You can feed this script different settings.
-mbsync -a "$@"
+if [ $# -eq 0 ]; then
+ mbsync -a
+else
+ mbsync "$@"
+fi
+
rm -f /tmp/imapsyncicon_$USER
pkill -RTMIN+12 i3blocks
diff --git a/bin/mw b/bin/mw
index 6f3cd95..aacc081 100755
--- a/bin/mw
+++ b/bin/mw
@@ -11,6 +11,7 @@ mbsyncrc="$HOME/.mbsyncrc"
mwconfig="$muttshare/mutt-wizard.muttrc"
cachedir="$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
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"
@@ -140,7 +141,7 @@ 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.*) 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" ;;
+ 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
fi
printf "Enter the \033[35mfull name\033[0m you want to be identified by on this account.\\n\tReal name: "
@@ -163,8 +164,11 @@ EOF
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
- [ ! -f "$HOME/.config/msmtp/config" ] && echo "$msmtp_header" > "$HOME/.config/msmtp/config"
- echo "$msmtp_profile" >> "$HOME/.config/msmtp/config"
+ [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc"
+ echo "$msmtp_profile" >> "$msmtprc"
+ case "$service" in
+ protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;;
+ esac
echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc"
echo "$mbsync_profile" >> "$mbsyncrc"
notmuchauto
@@ -174,6 +178,11 @@ EOF
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 --tls --tls-certcheck=off -a "$title")" || return 1
+ sed -ibu "s/account $title/&\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu
+}
+
getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1
pass insert "mutt-wizard-$title" && break; done ;}
@@ -233,10 +242,10 @@ pick() { printf "Select an accounts to %s:\\n" "$1"
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" "$HOME/.config/msmtp/config"; rm -f "$HOME/.config/msmtp/configbu"
+ sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu
}
-choosecron() { ! pgrep -x cron\|crond >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1
+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"
diff --git a/bin/openfile b/bin/openfile
index 19cb077..a3163f3 100755
--- a/bin/openfile
+++ b/bin/openfile
@@ -1,8 +1,9 @@
#!/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"
base=$(basename "$1")
ext="${base##*.}"
file=$(mktemp -u --suffix=".$ext")
rm -f "$file"
cp "$1" "$file"
-setsid xdg-open "$file" >/dev/null 2>&1 &
+$opener "$file" >/dev/null 2>&1 &
diff --git a/domains.csv b/share/domains.csv
index 4728fb4..3c7658e 100644
--- a/domains.csv
+++ b/share/domains.csv
@@ -37,6 +37,7 @@ cash4u.com,imap.mail.com,993,smtp.mail.com,587
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
+chrissx.ga,chrissx.ga,993,chrissx.ga,25
clerk.com,imap.mail.com,993,smtp.mail.com,587
clubmember.org,imap.mail.com,993,smtp.mail.com,587
cocaine.ninja,mail.cock.li,993,mail.cock.li,587
@@ -62,7 +63,7 @@ disroot.org,disroot.org,993,disroot.org,587
distruzione.org,mail.autistici.org,993,smtp.autistici.org,465
dr.com,imap.mail.com,993,smtp.mail.com,587
duke.edu,outlook.office365.com,993,smtp.office365.com,587
-email.arizona.edu,mail.catnet.arizona.edu,993,smtpgate.email.arizona.edu,587
+email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587
email.com,imap.mail.com,993,smtp.mail.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
@@ -75,6 +76,7 @@ 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
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
@@ -98,8 +100,8 @@ illinois.edu, imap.gmail.com,993,smtp.gmail.com,465
iname.com,imap.mail.com,993,smtp.mail.com,587
insiberia.net,mail.autistici.org,993,smtp.autistici.org,465
insicuri.net,mail.autistici.org,993,smtp.autistici.org,465
-interia.eu,poczta.interia.pl,143,poczta.interia.pl,465
-interia.pl,poczta.interia.pl,143,poczta.interia.pl,465
+interia.eu,poczta.interia.pl,993,poczta.interia.pl,465
+interia.pl,poczta.interia.pl,993,poczta.interia.pl,465
inventati.org,mail.autistici.org,993,smtp.autistici.org,465
kipras.org,mail.kipras.org,993,mail.kipras.org,587
krutt.org,mail.autistici.org,993,smtp.autistici.org,465
@@ -124,6 +126,7 @@ national.shitposting.agency,mail.cock.li,993,mail.cock.li,587
netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465
nigge.rs,mail.cock.li,993,mail.cock.li,587
nuke.africa,mail.cock.li,993,mail.cock.li,587
+nyu.edu,imap.gmail.com,993,smtp.gmail.com,587
o2.pl,poczta.o2.pl,993,poczta.o2.pl,465
onenetbeyond.org,mail.autistici.org,993,smtp.autistici.org,465
onet.com.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465
@@ -135,8 +138,10 @@ opoczta.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465
orange.fr,imap.orange.fr,993,smtp.orange.fr,465
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.at,imap-mail.outlook.com,993,smtp-mail.outlook.com,587
paranoici.org,mail.autistici.org,993,smtp.autistici.org,465
-poczta.fm,poczta.interia.pl,143,poczta.interia.pl,465
+pm.me,127.0.0.1,1143,127.0.0.1,1025
+poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465
poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465
post.com,imap.mail.com,993,smtp.mail.com,587
posteo.de,posteo.de,993,posteo.de,587
@@ -152,6 +157,8 @@ sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587
spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465
stronzi.org,mail.autistici.org,993,smtp.autistici.org,465
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
+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
techie.com,imap.mail.com,993,smtp.mail.com,587
@@ -161,6 +168,7 @@ tfwno.gf,mail.cock.li,993,mail.cock.li,587
tlen.pl,poczta.o2.pl,993,poczta.o2.pl,465
tu-harburg.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587
tuhh.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587
+txstate.edu,outlook.office365.com,993,smtp.office365.com,587
uach.mx,imap.gmail.com,993,smtp.gmail.com,587
uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587
uqtr.ca,outlook.office365.com,993,smtp.office365.com,587
diff --git a/mailcap b/share/mailcap
index c9c0a68..c9c0a68 100644
--- a/mailcap
+++ b/share/mailcap
diff --git a/mutt-wizard.muttrc b/share/mutt-wizard.muttrc
index c8b7b59..c8b7b59 100644
--- a/mutt-wizard.muttrc
+++ b/share/mutt-wizard.muttrc