summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile30
-rw-r--r--README.md12
-rwxr-xr-xbin/mailsync15
-rwxr-xr-xbin/mw13
-rw-r--r--mw.11
-rw-r--r--share/domains.csv3
-rw-r--r--share/imapnotify-temp15
-rw-r--r--share/mutt-temp4
-rw-r--r--share/mutt-wizard.muttrc2
9 files changed, 59 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index a150447..623aaf7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,39 +1,27 @@
.POSIX:
-OS = $(shell uname -s)
-ifndef PREFIX
- PREFIX = /usr/local
-endif
-ifndef MANPREFIX
- MANPREFIX = $(PREFIX)/share/man
-endif
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard
- cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/
- cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
- chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
+ cp -f bin/mailsync $(DESTDIR)$(PREFIX)/bin
+ cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
for shared in share/*; do \
cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \
done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
- cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
+ sed 's:/usr/local:$(PREFIX):' < share/mutt-wizard.muttrc > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc
+ sed 's:/usr/local:$(PREFIX):' < share/mailcap > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap
+ sed 's:/usr/local:$(PREFIX):' < bin/mw > $(DESTDIR)$(PREFIX)/bin/mw
+ sed 's:/usr/local:$(PREFIX):' < mw.1 > $(DESTDIR)$(MANPREFIX)/man1/mw.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
- if [ "$(PREFIX)" ]; then \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \
- rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \
- rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \
- rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \
- sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \
- rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \
- fi
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
chmod 755 $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
cp -f completion/_mutt-wizard.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_mutt-wizard.zsh
diff --git a/README.md b/README.md
index 76e2461..ba0517e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ https://muttwizard.com/
Get this great stuff without effort:
-- A full-featured and autoconfigured email client on the terminal with neomutt
+- A full-featured and autoconfigured email client on the terminal wibuiltth neomutt
- Mail stored offline enabling the ability to:
* view and write emails while you're away from
the internet
@@ -54,6 +54,8 @@ A user of Arch-based distros can also install the current mutt-wizard release fr
### Optional Dependencies
+- `goimapnotify` - required for push notifications.
+ [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
- `pam-gnupg` - Automatically logs you into your GPG key on login so you will
never need to input your password once logged on to your system. Check the
repo and directions out [here](https://github.com/cruegge/pam-gnupg).
@@ -134,6 +136,12 @@ To give you an example of the interface, here's an idea:
- <kbd>ctrl-b</kbd> - open a menu to select a URL you want to open in your browser.
- <kbd>p</kbd> - encrypt/sign your message (in compose view, before sending the email).
+## Enable push notifications per mail
+**Note**: Replace the `fulladdrs` with your actual email address. You have to do this for each new mail you want to setup instant notifications.
+```bash
+systemctl enable --user goimapnotify@fulladdrs.service
+```
+
## Additional functionality
- `pam-gnupg` - Automatically logs you into your GPG key on login, so you will
@@ -209,6 +217,8 @@ To give you an example of the interface, here's an idea:
applications requires turning off two-factor authentication and this will
circumvent that. You might also need to manually "Enable IMAP" in the
settings.
+ To create an App Password for your Google account,
+ you can directly visit the [App Passwords](https://myaccount.google.com/apppasswords) page in your Google Account settings.
- 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.
diff --git a/bin/mailsync b/bin/mailsync
index 9c7f457..3a681f0 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -48,7 +48,7 @@ case "$(uname)" in
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
export DISPLAY="$x"
- notify-send --app-name="mutt-wizard" "$1" "$2"
+ notify-send --app-name="mutt-wizard" -- "$1" "$2"
done ;}
;;
esac
@@ -66,16 +66,17 @@ syncandnotify() {
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
case 1 in
$((newcount > 5)) )
- echo "$newcount new mail for $2."
- [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account."
+ echo "$newcount new mails for $2." >/dev/tty
+ [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account."
;;
$((newcount > 0)) )
- echo "$newcount new mail for $2."
+ echo "$newcount new mail(s) for $2." >/dev/tty
[ -z "$MAILSYNC_MUTE" ] &&
for file in $new; do
- # Extract and decode subject and sender from mail.
- subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" |
- perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
+ # Extract and decode subject and sender from mail.
+ subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 |
+ perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
+ sed 's/^Subject: //' | tr -d '\n\t')
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"
diff --git a/bin/mw b/bin/mw
index cdb7856..5503e88 100755
--- a/bin/mw
+++ b/bin/mw
@@ -12,12 +12,14 @@ msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config"
msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log"
mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}"
mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config"
+imapnotify="${XDG_CONFIG_HOME:-$HOME/.config}/imapnotify"
mpoptemp="$muttshare/mpop-temp"
mbsynctemp="$muttshare/mbsync-temp"
mutttemp="$muttshare/mutt-temp"
msmtptemp="$muttshare/msmtp-temp"
onlinetemp="$muttshare/online-temp"
notmuchtemp="$muttshare/notmuch-temp"
+imapnotifytemp="$muttshare/imapnotify-temp"
# With the use of templates, it's impossible to use parameter substitution.
# Therefore, some default variables that might be otherwise overwritten are set
# here.
@@ -78,6 +80,10 @@ prepmpop() {
envsubst <"$mpoptemp" >>"$mpoprc"
}
+prepimapnotify() {
+ mkdir -p "${imapnotify%/*}" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf"
+}
+
prepmutt() {
mkdir -p "${muttrc%/*}" "$accdir"
envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc"
@@ -106,6 +112,7 @@ getprofiles() {
prepmsmtp
prepmutt
prepnotmuch
+ prepimapnotify
}
parsedomains() {
@@ -173,11 +180,11 @@ askinfo() {
[ -z "$passprefix" ] && passprefix=""
hostname="${fulladdr#*@}"
login="${login:-$fulladdr}"
- if [ -n "${password+x}" ]; then
+ if [ -n "${password+x}" ] && [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
insertpass
- else
+ elif [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
getpass
- fi
+ fi
}
insertpass() {
diff --git a/mw.1 b/mw.1
index 4a136ee..f40db45 100644
--- a/mw.1
+++ b/mw.1
@@ -70,6 +70,7 @@ SMTP server port (assumed to be 465 if not specified)
.TP
.B -x
Account password. You will be prompted for the password interactively if this option is not given.
+.TP
.B -P
Pass Prefix. The password will be stored using pass at <passprefix><email>
.SH OTHER OPTIONS
diff --git a/share/domains.csv b/share/domains.csv
index 835d96c..beb7a1e 100644
--- a/share/domains.csv
+++ b/share/domains.csv
@@ -117,6 +117,7 @@ freedom.nl,imap.freedom.nl,993,smtp.freedom.nl,465
freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
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
+fz-juelich.de,imap.fz-juelich.de,993,mail.fz-juelich.de,587
gcc.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587
getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587
ghalv.no,mail.ghalv.no,993,mail.ghalv.no,465
@@ -200,7 +201,7 @@ national.shitposting.agency,mail.cock.li,993,mail.cock.li,587
ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587
netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465
nigge.rs,mail.cock.li,993,mail.cock.li,587
-niser.ac.in,imap.gmail.com,993,smtp.gmail.com,587
+niser.ac.in,imap.gmail.com,993,smtp.gmail.com,465
nixnet.email,imap.nixnet.email,143,smtp.nixnet.email,587
nixnet.xyz,imap.nixnet.email,143,smtp.nixnet.email,587
nixnetmail.com,imap.nixnet.email,143,smtp.nixnet.email,587
diff --git a/share/imapnotify-temp b/share/imapnotify-temp
new file mode 100644
index 0000000..a81cba2
--- /dev/null
+++ b/share/imapnotify-temp
@@ -0,0 +1,15 @@
+{
+ "host": "$imap",
+ "port": $iport,
+ "tls": true,
+ "tlsOptions": {
+ "rejectUnauthorized": false
+ },
+ "username": "$login",
+ "password": "",
+ "passwordCmd": "pass $passprefix$fulladdr",
+ "onNewMail": "mailsync",
+ "onNewMailPost": "",
+ "boxes": [ "INBOX" ]
+}
+
diff --git a/share/mutt-temp b/share/mutt-temp
index 81148a1..63841ad 100644
--- a/share/mutt-temp
+++ b/share/mutt-temp
@@ -1,6 +1,6 @@
# vim: filetype=neomuttrc
# muttrc file for account $fulladdr
-set realname = "$realname"
+set real_name = "$realname"
set from = "$fulladdr"
set sendmail = "msmtp -a $fulladdr"
alias me $realname <$fulladdr>
@@ -10,7 +10,7 @@ set message_cachedir = "$cachedir/$safename/bodies"
set mbox_type = Maildir
set hostname = "$hostname"
source $muttshare/switch.muttrc
-set spoolfile = "+INBOX"
+set spool_file = "+INBOX"
set postponed = "+Drafts"
set trash = "+Trash"
set record = "+Sent"
diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc
index 95a9ae9..f236bc4 100644
--- a/share/mutt-wizard.muttrc
+++ b/share/mutt-wizard.muttrc
@@ -101,7 +101,7 @@ macro index \eh "<pipe-message>$prefix/libexec/gpg-wks-client --receive | msmtp
macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook"
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
macro index O "<shell-escape>mailsync<enter>" "run mailsync to sync all mail"
-macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern"
+macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read x; echo \$x >\"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\"<enter><limit>~i \"\`notmuch search --output=messages \$(cat \"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\") | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/g for@a; s/\\$/\\\\\\$/g for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern"
macro index A "<limit>all\n" "show all messages (undo limit)"
# Sidebar mappings