Skip to content

Instantly share code, notes, and snippets.

@likejazz
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save likejazz/a64356132f53b05213ca to your computer and use it in GitHub Desktop.
Save likejazz/a64356132f53b05213ca to your computer and use it in GitHub Desktop.
#!/bin/bash
DAUMID=*****
DAUMPW=*****
# IMAP SSL/TLS
response=`{ echo "a001 login $DAUMID $DAUMPW"; sleep 1; echo "a002 select inbox"; sleep 1; echo "a003 logout"; } | /usr/local/bin/gnutls-cli imap.daum.net --port=993`
# fetch `UNSEEN` mail count
unseen=$(echo $response | grep -oEi 'OK\ \[UNSEEN\ (\d+)' | awk '{print $3}')
# if `$UNSEEN` is number, notify to me.
if [[ $unseen =~ ^[0-9]+$ ]] ; then
terminal-notifier -message "You've got ${unseen} mails." -title "한메일" -open http://hmstage.daum.net/hanmailex/Top.daum
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment