diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | bin/mailsync | 31 | ||||
| -rwxr-xr-x | bin/mw | 2 | ||||
| -rw-r--r-- | share/domains.csv | 1 | ||||
| -rw-r--r-- | share/mbsync-temp | 2 | ||||
| -rw-r--r-- | share/mutt-temp | 2 |
6 files changed, 30 insertions, 10 deletions
@@ -4,7 +4,7 @@ https://muttwizard.com/ Get this great stuff without effort: -- A full-featured and autoconfigured email client on the terminal wibuiltth neomutt +- A full-featured and autoconfigured email client on the terminal built with neomutt - Mail stored offline enabling the ability to: * view and write emails while you're away from the internet diff --git a/bin/mailsync b/bin/mailsync index 3a681f0..7bca2d0 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -58,7 +58,7 @@ syncandnotify() { case "$1" in imap) mbsync -q "$2" ;; pop) mpop -q "$2" ;; - esac + esac || return 1 new=$(find\ "$HOME/.local/share/mail/$2/"[Ii][Nn][Bb][Oo][Xx]/new/ \ "$HOME/.local/share/mail/$2/"[Ii][Nn][Bb][Oo][Xx]/cur/ \ @@ -74,7 +74,7 @@ syncandnotify() { [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. - subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | + subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | sed '$d' | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | tr -d '\n\t') from="$(sed -n "/^From:/ s|From: *|| p" "$file" | @@ -100,15 +100,34 @@ else done || echo "error $arg"; done)" fi +pids= # PIDs of backgrounded subshells +count=0 # number of accounts in $tosync +failed=0 # number of failed sync attempts for account in $tosync; do + count=$((count+1)) case $account in - Channel*) syncandnotify imap "${account##* }" & ;; - account*) syncandnotify pop "${account##* }" & ;; - error*) echo "ERROR: Account ${account##* } not found." ;; + Channel*) + syncandnotify imap "${account##* }" & + pids="$pids $!" + ;; + account*) + syncandnotify pop "${account##* }" & + pids="$pids $!" + ;; + error*) + echo "ERROR: Account ${account##* } not found." + failed=$((failed+1)) + ;; esac done -wait +IFS=' ' +for pid in $pids; do + wait $pid || failed=$((failed+1)) +done + +# Abort if no account sync succeeded +[ "$count" -gt "$failed" ] || exit 1 notmuch new --quiet @@ -86,7 +86,7 @@ prepmpop() { } prepimapnotify() { - mkdir -p "$imapnotify" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf" + mkdir -p "$imapnotify" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.yaml" } prepmutt() { diff --git a/share/domains.csv b/share/domains.csv index beb7a1e..374dce7 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -304,6 +304,7 @@ 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-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 +uni-weimar.de,mailgate.uni-weimar.de,993,mailgate.uni-weimar.de,465 uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587 uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 diff --git a/share/mbsync-temp b/share/mbsync-temp index 4e77b09..ead3920 100644 --- a/share/mbsync-temp +++ b/share/mbsync-temp @@ -4,7 +4,7 @@ Port $iport User $login PassCmd "pass $passprefix$fulladdr" AuthMechs LOGIN -SSLType $imapssl +TLSType $imapssl CertificateFile $sslcert MaildirStore $fulladdr-local diff --git a/share/mutt-temp b/share/mutt-temp index 63841ad..82e16ef 100644 --- a/share/mutt-temp +++ b/share/mutt-temp @@ -6,7 +6,7 @@ set sendmail = "msmtp -a $fulladdr" alias me $realname <$fulladdr> set folder = "$folder" set header_cache = "$cachedir/$safename/headers" -set message_cachedir = "$cachedir/$safename/bodies" +set message_cache_dir = "$cachedir/$safename/bodies" set mbox_type = Maildir set hostname = "$hostname" source $muttshare/switch.muttrc |
