Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goimapnotify for push notifications #924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Specifically, this wizard:
- `msmtp` - sends the email.
- `pass` - safely encrypts passwords (required at install).
- `ca-certificates` - required for SSL. Probably installed already.
- `goimapnotify` - required for push notifications. [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).

**Note**: 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
Expand Down Expand Up @@ -133,6 +134,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 [email protected]
```

## Additional functionality

- `pam-gnupg` - Automatically logs you into your GPG key on login, so you will
Expand Down
5 changes: 5 additions & 0 deletions bin/mw
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config"
msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/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.
Expand Down Expand Up @@ -64,6 +66,8 @@ prepmbsync() { mkdir -p "${mbsyncrc%/*}" ; [ -f "$mbsyncrc" ] && echo >> "$mbsyn

prepmpop() { mkdir -p "${mpoprc%/*}" ; envsubst < "$mpoptemp" >> "$mpoprc" ;}

prepimapnotify() { mkdir -p "${imapnotify%/*}" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf" ;}

prepmutt() { mkdir -p "${muttrc%/*}" "$accdir"
envsubst < "$mutttemp" > "$accdir/$fulladdr.muttrc"
[ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc"
Expand All @@ -90,6 +94,7 @@ getprofiles() { \
prepmsmtp
prepmutt
prepnotmuch
prepimapnotify
}

parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
Expand Down
15 changes: 15 additions & 0 deletions share/imapnotify-temp
Original file line number Diff line number Diff line change
@@ -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" ]
}