diff --git a/README.md b/README.md index 663b3ab..76d5f04 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ Specifically, this wizard: ## Install and Use ``` -git clone https://github.com/LukeSmithxyz/mutt-wizard +git clone https://github.com/rpuntaie/mutt-wizard cd mutt-wizard 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/). +User of Arch-based distros can also install mutt-wizard from the AUR as [mw-git](https://aur.archlinux.org/packages/mw-git/). The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. @@ -119,10 +119,6 @@ Look into `/usr/share/mutt-wizard.muttrc` to see all bindings. - Try mutt-wizard out on weird machines and weird email addresses and report any errors. - Open a PR to add new server information into `domains.csv` so their users can 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). mutt-wizard is free/libre software, licensed under the GPLv3. diff --git a/bin/mw b/bin/mw index 2b68f4c..c68220f 100755 --- a/bin/mw +++ b/bin/mw @@ -127,7 +127,7 @@ defaults auth on tls on tls_trust_file $mwsslcert -logfile ${XDG_LOG_HOME:-$HOME}/msmtp.log +#logfile ${XDG_LOG_HOME:-$HOME}/msmtp.log EOF else sed -i "/account $mwaddr/,/^\(\s*$\|account\)/d" "$mwmsmtprc" &>/dev/null @@ -198,7 +198,7 @@ path = $mwaccmaildir/INBOX/ [options] read_all = true delete = true -message_log = ${XDG_LOG_HOME:-$HOME}/getmail.log +#message_log = ${XDG_LOG_HOME:-$HOME}/getmail.log # vim: ft=conf EOF @@ -209,7 +209,7 @@ _mwprofiles() { # mutt [ ! -f "$mwgenmuttaccs" ] && _mwgenmuttaccs - if [ "$mwtype" = "offline" ]; then + if [ "$mwtype" = "offline" ]; then # not online, actually outside mutt if [ "${mwkind::3}" = "pop" ]; then _mwpop else @@ -222,7 +222,7 @@ _mwprofiles() { _mwtryconnect() { if [ ! -d "$mwaccmaildir" ]; then - mwaccmaildirWasThere="NO" # need to remove again for "online" + [ ! "${mwkind::3}" = "pop" ] && mwaccmaildirWasThere="NO" # mutt uses $mwacccachedir for "online" IMAP, so clean up later mkdir -p "$mwaccmaildir" fi if [ -z "$mwmailboxes" ]; then @@ -232,7 +232,7 @@ _mwtryconnect() { python -c "from poplib import $mwp;p=$mwp('$mwurl');print(p.getwelcome());p.quit()" | \ grep "+OK" && mwmailboxes="INBOX" else - # for online do without mbsync, as it might not be installed + # for online do without mbsync, i.e. don't require it for mail setup, either # mwmailboxes="$($mwmbsyncbin -l $mwaddr | sed 's/\//./')" >/dev/null 2>&1 [ "$mwport" = "143" ] && mwi="IMAP4" || mwi="IMAP4_SSL" mwpw="$(pass $mwpass)" @@ -255,17 +255,21 @@ _mwtryconnect() { _mwfinalize() { # new mwaccmuttrc if [ "$mwtype" = "online" ]; then - mkdir -p "$mwacccachedir" - sed -i "/IMAPStore $mwaddr-remote$/,/# End mw profile/d" "$mwmbsyncrc" &>/dev/null + if [ ! "${mwkind::3}" = "pop" ]; then + mkdir -p "$mwacccachedir" + fi fi _mwgenmwaccmuttrc || return 1 - if [ "$mwtype" = "offline" ]; then + if [ "$mwtype" = "offline" ]; then # not online _mwnotmuchauto printf "All done.\\n\033[33mYou can now run \`\033[32mmw [%s]\033[33m\` to sync your mail.\033[0m\\n" "$mwaddr" + elif [ "${mwkind::3}" = "pop" ]; then # and online + _mwnotmuchauto #still usable for online (in mutt) pop fi if [ "$mwtype" = "online" ]; then [ "$mwaccmaildirWasThere" = "NO" ] && rm -rf "$mwaccmaildir" &>/dev/null fi + return 0 } _mwconfirm() { @@ -290,7 +294,7 @@ _mwpick() { _mwdelete() { [ "$mwaccmaildirWasThere" = "NO" ] && rm -rf "$mwaccmaildir" &>/dev/null rm -f "$mwaccmuttrc" &>/dev/null - if [ "$mwtype" = "offline" ]; then + if [ "$mwtype" = "offline" ]; then # not online sed -i "/${mwaccmuttrc//\//\\\/}/d" "$mwgenmuttaccs" &>/dev/null sed -i "/account $mwaddr/,/^\(\s*$\|account\)/d" "$mwmsmtprc" &>/dev/null if [ -f "$mwgetmaildir/$mwaddr" ]; then @@ -332,7 +336,8 @@ _mwcron() { _mwasktype() { if [ -z "$mwtype" ]; then while : ; do - printf "[yes/no]: Local mail via mbsync? 'no' means, that Mutt remotes, which is slower.\\n" + printf "Do you want to sync your mails using the command 'mw' outside mutt? [yes/no]\\n" + printf "'no' makes Neomutt slow for IMAP accounts, so probably you want 'yes'.\\n\t" read -r mwoffline case "$mwoffline" in [Yy][Ee][Ss]) mwtype="offline" && break ;; @@ -356,7 +361,7 @@ _mwpurge() { done rm -rf "$mwaccmuttdir"/[1-9]-*.muttrc "$mwcachedir" "$mwgenmuttaccs" sed -i "/\# mw-autogenerated/d" "$mwmuttrc" - pgrep cron >/dev/null && crontab -l | sed '/mw sync/d' | crontab - >/dev/null + crontab -l | sed '/mw sync/d' | crontab - >/dev/null echo "All configs and account settings have been purged." } @@ -390,11 +395,11 @@ _mwgenmwaccmuttrc() { mwspoolfile=$(echo "$mwmailboxes" | grep -i -m 1 inbox | sed -ne 's/.*/+\0/p') [ "${mwspoolfile/ /}" = "" ] && return 1 mwrecord=$(echo "$mwmailboxes" | grep -i -m 1 sent | sed -ne 's/.*/+\0/p') - [ -z "$mwrecord" ] && mkdir -p "$mwaccmaildir/Sent/"{cur,new,tmp} && mwrecord="Sent" + [ -z "$mwrecord" ] && mkdir -p "$mwaccmaildir/Sent/"{cur,new,tmp} && mwrecord="+Sent" mwpostponed=$(echo "$mwmailboxes" | grep -i -m 1 draft | sed -ne 's/.*/+\0/p') - [ -z "$mwpostponed" ] && mkdir -p "$mwaccmaildir/Drafts/"{cur,new,tmp} && mwpostponed="Drafts" + [ -z "$mwpostponed" ] && mkdir -p "$mwaccmaildir/Drafts/"{cur,new,tmp} && mwpostponed="+Drafts" mwtrash=$(echo "$mwmailboxes" | grep -i -m 1 trash | sed -ne 's/.*/+\0/p') - [ -z "$mwtrash" ] && mkdir -p "$mwaccmaildir/Trash/"{cur,new,tmp} && mwtrash="Trash" + [ -z "$mwtrash" ] && mkdir -p "$mwaccmaildir/Trash/"{cur,new,tmp} && mwtrash="+Trash" # again to reflect the change mwmailboxes="$(find "$mwaccmaildir/" -name cur | sed "s,$mwaccmaildir/,,g;s,/cur,,")" # find mwaccmuttrc ... @@ -411,7 +416,7 @@ _mwgenmwaccmuttrc() { # link mwaccmuttrc ... if [ "$mwtype" = "offline" ]; then ! grep "source $mwaccmuttrc" "$mwgenmuttaccs" &>/dev/null && echo "source $mwaccmuttrc" >> $mwgenmuttaccs - else + else #online ! grep "source $mwaccmuttrc" "$mwmuttrc" &>/dev/null && echo "source $mwaccmuttrc # mw-autogenerated" >> $mwmuttrc fi # (re-)generate mwaccmuttrc ... @@ -438,13 +443,18 @@ EOF if [ "${mwkind::3}" = "pop" ]; then cat >> "$mwaccmuttrc" <> "$mwaccmuttrc" < EOF IFS=$'\n' for eqbox in $mwmailboxes; do - qbox=${eqbox/[/} - b1=${qbox::1} - box=${qbox##*/} - [ "$box" = "$qbox" ] && b2=${qbox:1:1} || b2=${box:1:1} + qbox="${eqbox/\[/}" + b1="${qbox::1}" + box="${qbox##*/}" + [ "$box" = "$qbox" ] && b2="${qbox:1:1}" || b2="${box:1:1}" boxi="$b1$b2" - boxi=${boxi,,} + boxi="${boxi,,}" cat >> $mwaccmuttrc <=$eqbox" "go to $eqbox" macro index,pager M$boxi "=$eqbox" "move mail to $eqbox" @@ -505,6 +515,7 @@ macro index,pager C$boxi "=$eqbox" "copy mail to $eqbox" EOF done unset IFS + return 0 } if [ "$(uname)" = "Darwin" ]; then @@ -566,9 +577,7 @@ _mwsyncandnotify() { if [ -f "$mwgetmaildir/$mwaddr" ]; then $mwgetmailbin --rcfile=$mwaddr --getmaildir=$mwgetmaildir else - tree $mwaccmaildir $mwmbsyncbin $mwaddr - tree $mwaccmaildir fi mwlastrun="$mwaccmaildir/.mw.lastrun" mwnew=$(find "$mwaccmaildir/INBOX/new/" "$mwaccmaildir/Inbox/new/" "$mwaccmaildir/inbox/new/" -type f -newer "$mwlastrun" 2> /dev/null) @@ -592,9 +601,8 @@ _mwsyncemails() { _mwsyncandnotify done rm $XDG_CONFIG_HOME/getmail/oldmail-* &>/dev/null - echo notmuch+afew ... + echo notmuch new ... notmuch new &>/dev/null - # notmuch also created afew MailMover target mailboxes } _mwmuttemails() { @@ -688,10 +696,11 @@ else cron) _mwcron ;; sync) _mwsync ;; *@*) _mwsync $1 ;; + --version|-v) echo "mutt-wizard version 0.9" ;; --help|-h) cat < originally in 2018. +Tests, Bugfixes, Improvements by Roland Puntaier in 2019. .SH LICENSE GPLv3 .SH SEE ALSO diff --git a/share/domains.csv b/share/domains.csv index c617b42..38fe611 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -264,4 +264,5 @@ 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 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 +mailo.com,mail.mailo.com,993,mail.mailo.com,465 chello.at,mail.upcmail.at,995,mail.upcmail.at,465 diff --git a/test/dotests b/test/dotests index 3d9c50e..2087252 100755 --- a/test/dotests +++ b/test/dotests @@ -35,8 +35,8 @@ if [ "$OK" = "OK" ]; then echo "= Test 1 =" mwtype=online mw add - echo "=> In another window, start mutt and verify that mails are shown" - echo "=> Then anwer with N" + echo "=> In another prompt, start mutt and verify that mails are shown" + echo "=> Then answer with N" mw purge rm -rf $mwaccmaildir @@ -44,10 +44,10 @@ if [ "$OK" = "OK" ]; then mwtype=offline mw add mw - echo "=> In another window, start mutt and verify that mails are shown" + echo "=> In another prompt, start mutt and verify that mails are shown" echo "=> Press i1, wait, press i2. Verify that mutt is fast again after i2." echo "=> Press gm and gM, to start mw sync." - echo "=> Anwer with Y and check that mbsyncrc, msmtp/config and mutt/accounts are gone." + echo "=> Answer with Y and check that mbsyncrc, msmtp/config and mutt/accounts are gone." mw purge fi