I don't use an email client, I just log in occasionally via browser. I wanted something like the mailwatch plugin in xfce to let me know if new mail arrives. After trying to understand some complicated python scripts, I found out that curl can do exactly what I want in one line (should have known). Here it is in case it's useful to someone.
Code: Select all
while true; do sleep 600
curl --silent --url "imaps://imap.fastmail.com" \
--user "username@fastmail.com:password" \
--request "STATUS INBOX (UNSEEN)" | \
grep "(UNSEEN 0)" && continue
[here I play a sound and have yad display "New email"]
done
Fastmail requires an app password for this. I think gmail does also. vivaldi.net works with regular login name and pwd.
curl commands to query email server
python script
other imap queries