diff options
Diffstat (limited to 'mbsync')
-rw-r--r-- | mbsync/.config/environment.d/20-mail.conf | 2 | ||||
-rw-r--r-- | mbsync/.config/imapnotify/porkbun.conf | 14 | ||||
-rw-r--r-- | mbsync/.config/mbsync/mbsyncrc | 19 | ||||
-rw-r--r-- | mbsync/.config/systemd/user/maildir-notify.service | 2 | ||||
-rwxr-xr-x | mbsync/.local/bin/maildir-notify | 12 |
5 files changed, 43 insertions, 6 deletions
diff --git a/mbsync/.config/environment.d/20-mail.conf b/mbsync/.config/environment.d/20-mail.conf index e3e2599..1c12b82 100644 --- a/mbsync/.config/environment.d/20-mail.conf +++ b/mbsync/.config/environment.d/20-mail.conf @@ -1 +1 @@ -MAIL=$XDG_DATA_HOME/mail/gmail/INBOX +MAIL=$XDG_DATA_HOME/mail/porkbun/INBOX diff --git a/mbsync/.config/imapnotify/porkbun.conf b/mbsync/.config/imapnotify/porkbun.conf new file mode 100644 index 0000000..60b71f9 --- /dev/null +++ b/mbsync/.config/imapnotify/porkbun.conf @@ -0,0 +1,14 @@ +{ + "host": "imap.porkbun.com", + "port": 993, + "tls": true, + "tlsOptions": { + "rejectUnauthorized": false + }, + "username": "tobyv@tobyvin.dev", + "passwordCmd": "pass tobyv@tobyvin.dev | head -n1", + "onNewMail": "mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc porkbun", + "boxes": [ + "INBOX" + ] +} diff --git a/mbsync/.config/mbsync/mbsyncrc b/mbsync/.config/mbsync/mbsyncrc index 32b6305..2fc8de6 100644 --- a/mbsync/.config/mbsync/mbsyncrc +++ b/mbsync/.config/mbsync/mbsyncrc @@ -2,6 +2,25 @@ Create Both Expunge Both SyncState * +IMAPAccount porkbun +Host imap.porkbun.com +User tobyv@tobyvin.dev +PassCmd "pass tobyv@tobyvin.dev" +SSLType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore porkbun-remote +Account porkbun + +MaildirStore porkbun-local +Path ~/.local/share/mail/porkbun/ +Inbox ~/.local/share/mail/porkbun/INBOX + +Channel porkbun +Far :porkbun-remote: +Near :porkbun-local: +Patterns * + IMAPAccount gmail Host imap.gmail.com User tobyv13@gmail.com diff --git a/mbsync/.config/systemd/user/maildir-notify.service b/mbsync/.config/systemd/user/maildir-notify.service index 59dc969..3c57b06 100644 --- a/mbsync/.config/systemd/user/maildir-notify.service +++ b/mbsync/.config/systemd/user/maildir-notify.service @@ -3,7 +3,7 @@ Description=Watches Maildir for new mail and sends notifications [Service] Type=simple -ExecStart=%h/.local/bin/maildir-notify %h/.local/share/mail/gmail/INBOX %h/.local/share/mail/feeds/INBOX +ExecStart=%h/.local/bin/maildir-notify RestartSec=10 [Install] diff --git a/mbsync/.local/bin/maildir-notify b/mbsync/.local/bin/maildir-notify index 198046e..065339f 100755 --- a/mbsync/.local/bin/maildir-notify +++ b/mbsync/.local/bin/maildir-notify @@ -1,7 +1,9 @@ #!/bin/sh if [ $# = 0 ]; then - set -- "$MAIL" + for d in "$XDG_DATA_HOME"/mail/*; do + set -- "$@" "${d}/INBOX" + done fi for i; do @@ -9,10 +11,12 @@ for i; do shift done +echo "Watching $*" + inotifywait --monitor --event create --event moved_to "$@" | while read -r dir _action file; do inbox="$(dirname "$dir")" - catagory="$(dirname "$inbox" | xargs basename)" + category="$(dirname "$inbox" | xargs basename)" from="$(grep -m1 -oP '(?<=^From: ).*' "${dir}${file}")" subject="$(grep -m1 -oP '(?<=^Subject: ).*' "${dir}${file}")" @@ -26,6 +30,6 @@ inotifywait --monitor --event create --event moved_to "$@" | fi fi - echo "Catagory: $catagory, From: $from, Subject: $subject" - notify-send -a "Mail" -c "$catagory" "From: $from" "$subject" + echo "Category: $category, From: $from, Subject: $subject" + notify-send -a "Mail" -c "$category" "From: $from" "$subject" done |