LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there a console gmail notifier (for crontab -e / user)? (https://www.linuxquestions.org/questions/linux-software-2/is-there-a-console-gmail-notifier-for-crontab-e-user-775604/)

frenchn00b 12-14-2009 01:06 PM

Is there a console gmail notifier (for crontab -e / user)?
 
Hello,

I am looking for a console gmail notifier
Is there already some solutions?

Best regards

MS3FGX 12-14-2009 01:19 PM

I don't know of anything specifically for GMail, but you could use any console POP3 or IMAP tool with GMail, you just need to enable support for one (or both) protocols in the GMail settings.

frenchn00b 12-14-2009 04:45 PM

There is certainly some ways to make a backend to gmail-notifier. it has been coded in python or perl if i recall well

worm5252 12-14-2009 04:51 PM

You could use a desktop widget.

frenchn00b 12-14-2009 09:41 PM

Quote:

Originally Posted by worm5252 (Post 3791461)
You could use a desktop widget.

I thank you, but I have not X11, :( so it would be console based intended.

frenchn00b 12-15-2009 11:58 AM

what about it?

Code:

#!/bin/bash
# name : checkmail.sh

# Username
echo "Eneter your gmail username: "
read login

# Password
echo ""
echo "Enter your gmail password: "
trap "stty echo; exit" 1 2 15 # able to restore stty setting, even on "Ctrl+C"
stty -echo
read passwd
stty echo
trap "" 1 2 15

if [ "$login" == "" -o "$passwd" == "" ]
then
        echo "Error: Username or password is empty."
        exit 65
fi

inbox=`wget -T 3 -t 1 -q --secure-protocol=TLSv1 --no-check-certificate \
--user=$login --password=$passwd \
https://mail.google.com/mail/feed/atom -O - | \
sed -ne '/fullcount/s:.*>\([0-9]\+\)/dev/null`
# Notice the 'x', it is from bounce shell
# to check whether it is null string or not, but it works in bash.
if [ ! x$inbox == x'' ]
then
        if [ ! $inbox -eq 0 ]
        then
                echo “$inbox new mails in your box.”
                Xdialog --msgbox "Please check your email!" 5 40 & # You may need to install Xdialog or comment it out
        else
                echo “No new mails found!”
        fi
else
        echo “Some error occurs!”
fi


frenchn00b 12-15-2009 12:01 PM

I would propose to improve this script using an SSL encoding of hte password, interested?


All times are GMT -5. The time now is 05:03 PM.