Yahoo notification script

Sunday, March 23rd, 2008 at 2:51 pm

Here is a quick script I wrote for my dad so that when he logs in it will tell him if he’s got any new messages.

If it was anything other than a basic yahoo account (webmail only, no POP or IMAP) I could have used the mail-notification package

#!/bin/bash

#requires packages libnotify-bin, fetchyahoo

# include settings from $HOME/.yahoomail, format as shown below
# USERNAME='my-yahoo-email-account'
# PASSWORD='my-password'
. $HOME/.yahoomail

MESSAGES=$(/usr/bin/fetchyahoo --quiet --username="$USERNAME" --password="$PASSWORD" --spoolfile=/dev/null --newonly --onlylistmessages)
COUNT=$(echo "$MESSAGES" | wc -l)

if [[ $COUNT -gt 0 ]]
then
    /usr/bin/notify-send "New Email" "You have $COUNT new messages"
fi

exit 0

I added it to the System->Preferences->Session and now when my dad logs in he doesn’t have to check for emails, the emails will check on their own.

Comments are closed.