Explorar el Código

Merge branch 'master' of github.com:LukeSmithxyz/mutt-wizard

tags/v3.1
Luke Smith hace 4 años
padre
commit
3d320f28c5
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4C50B54A911F6252
Se han modificado 4 ficheros con 21 adiciones y 12 borrados
  1. +3
    -3
      README.md
  2. +4
    -4
      bin/mailsync
  3. +13
    -4
      bin/mw
  4. +1
    -1
      mw.1

+ 3
- 3
README.md Ver fichero

@@ -3,13 +3,13 @@
Get this great stuff without effort:

- A full-featured and autoconfigured email client on the terminal with neomutt
- Mail stored offline so you can view and write email while away from internet and keep backups
- Mail stored offline so you can view and write email while you're away from internet and keep backups

Specifically, this wizard:

- Determines your email server's IMAP and SMTP servers and ports
- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address
- Encrypts and stores locally your password for easy remote access, accessible only by your GPG key
- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key
- Handles as many as nine separate email accounts automatically
- Auto-creates bindings to switch between accounts or between mailboxes
- Can automatically set mail updates as often as you want to sync your mail and update you when new mail arrives
@@ -112,5 +112,5 @@ mutt-wizard is free/libre software, licensed under the GPLv3.

## To-do

- Add ~~Mac OS~~/BSD compatibility (the script is confired to work for Mac OS now)
- Add ~~Mac OS~~/~~BSD~~ compatibility (the script is confirmed to work for Mac OS and FreeBSD now)
- ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM)

+ 4
- 4
bin/mailsync Ver fichero

@@ -12,7 +12,7 @@ ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; e
command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."

# Required to display notifications if run as a cronjob:
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
export DISPLAY=:0.0

# For individual configurations:
@@ -21,7 +21,7 @@ export DISPLAY=:0.0
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
messageinfo() { osascript "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
else
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}
@@ -30,7 +30,7 @@ fi
# Check account for new mail. Notify if there is new content.
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
mbsync $opts "$acc"
mbsync "$opts" "$acc"
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
@@ -38,7 +38,7 @@ syncandnotify() {
for file in $new; do
# Extract subject and sender from mail.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
messageinfo &
done
fi


+ 13
- 4
bin/mw Ver fichero

@@ -3,11 +3,11 @@
command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
[ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store"
[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] &&
"$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || {
"$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || {
printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG"
exit
}
! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit
! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit

prefix="/usr/local"
muttdir="$HOME/.config/mutt" # Main mutt config location
@@ -86,6 +86,9 @@ set folder = \"$maildir/$title\"
set header_cache = $cachedir/$title/headers
set message_cachedir = $cachedir/$title/bodies
set mbox_type = Maildir
set crypt_opportunistic_encrypt = yes
set pgp_self_encrypt = yes
set pgp_default_key = $keyid

bind index,pager gg noop
bind index,pager g noop
@@ -108,6 +111,11 @@ set header_cache = $cachedir/$title/headers
set message_cachedir = $cachedir/$title/bodies
set imap_pass = \"\`pass mutt-wizard-$title\`\"

set crypt_opportunistic_encrypt = yes
set pgp_self_encrypt = yes
set pgp_default_key = $keyid


set mbox_type = Maildir
set ssl_starttls = yes
set ssl_force_tls = yes
@@ -126,6 +134,7 @@ fi
askinfo() { \
printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m"
read -r fulladdr
keyid=$( gpg --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }')
printf "\033[0m"
while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do
printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t"
@@ -136,7 +145,7 @@ askinfo() { \
search_query=$domain
case "$domain" in
protonmail.com|protonmail.ch|pm.me)
search_query='protonmail.com' && break;;
search_query='protonmail.com' && return 1;;
*)
while : ; do
printf "\nIs your email hosted with Protonmail? [yes/no] "
@@ -330,7 +339,7 @@ synchronize_flags=true
gpg_path=$GPG"
echo "$nmbasic" > "$NOTMUCH_CONFIG" ;}

trap 'echo -e "\033[0m\n"; exit' STOP INT ABRT KILL
trap 'echo -e "\033[0m\n"; exit' INT ABRT

case "$1" in
ls) list ;;


+ 1
- 1
mw.1 Ver fichero

@@ -6,7 +6,7 @@ mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync
<command>
.SH DESCRIPTION
.B mw
takes a user email account and sets up a terminal-based email interface with it for
takes a user email account and sets up a terminal-based email interface for it with
.B neomutt.
This can include offline email with
.B isync/mbsync


Cargando…
Cancelar
Guardar