Hello Oldhacker, I have a very simply and light solution for you!
That's a working script:
Code:
#!/bin/bash
check_emails(){
count=0;
#FIRST ACCOUNT
gmail_login="FISRT_ACCOUNT_HERE@gmail.com"
gmail_password="FIRST_PASSWORD_HERE"
count=$(wget -q -O - https://mail.google.com/a/gmail.com/feed/atom --http-user=${gmail_login} --http-password=${gmail_password} --no-check-certificate | grep fullcount | sed 's/<[^0-9]*>//g')
if [ $count -gt 0 ]; then
notify-send "GMAIL" "$gmail_login - $count new emails"
fi
#SECOND ACCOUNT
gmail_login="SECOND_ACCOUNT_HERE@gmail.com"
gmail_password="SECOND_PASSWORD_HERE"
count=$(wget -q -O - https://mail.google.com/a/gmail.com/feed/atom --http-user=${gmail_login} --http-password=${gmail_password} --no-check-certificate | grep fullcount | sed 's/<[^0-9]*>//g')
if [ $count -gt 0 ]; then
notify-send "GMAIL" "$gmail_login - $count new emails"
fi
}
#PROGRAM STARTS HERE
#timeout in case you have selected starting the script in startup
sleep 5 #set your own timeout if you want
while true; do
check_emails #run the function
sleep 15m #timeout to wait between each check
done
You should change the words in capital and everything after the 'sleep' commands, it is the timeout.
You can repeat the same thing in the function check_emails for any gmail accounts you want to.
EDIT: forgot to add that you have to install the package that contains the command notify-send, I think it is libnotify-bin or similar.
Also, you can place the script in your startup applications!
Bookmarks