Browse Source

use curl to login

rm mbsync requirement for online storage
tags/v3.1
Luke Smith 3 years ago
parent
commit
ca9f1a12cc
No known key found for this signature in database GPG Key ID: 4C50B54A911F6252
2 changed files with 9 additions and 13 deletions
  1. +3
    -2
      README.md
  2. +6
    -11
      bin/mw

+ 3
- 2
README.md View File

@@ -66,9 +66,10 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u
## Dependencies

- `neomutt` - the email client.
- `isync` - downloads and syncs the mail. (required at install)
- `curl` - tests connections (required at install).
- `isync` - downloads and syncs the mail (required if storing IMAP mail locally).
- `msmtp` - sends the email.
- `pass` - safely encrypts passwords (required at install)
- `pass` - safely encrypts passwords (required at install).

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 recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`.



+ 6
- 11
bin/mw View File

@@ -199,9 +199,8 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_
# On Ubuntu/Debian, a link is needed since they use an older version.
command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null

# Create the mbsync config file.
mkdir -p "${mbsyncrc%/*}"
echo "$mbsync_profile" >> "$mbsyncrc"
# Create the mbsync config file if local account.
[ -z "${online+x}" ] && mkdir -p "${mbsyncrc%/*}" && echo "$mbsync_profile" >> "$mbsyncrc"

# Create a muttrc for viewing mail.
echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc"
@@ -230,14 +229,10 @@ Junk
Trash
Sent
Archive" && return 0
if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then
[ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu
return 0
else
echo "$mailboxes"
echo "Log-on not successful."
return 1
fi ;}
info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" ||
{ echo "Log-on not successful." ; exit 1 ;}
mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')"
}

finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new"
sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu"


Loading…
Cancel
Save