gmail.pl: A Script for Securely Checking Your Gmail Account From the Command Line
gmail.pl is a script that checks for new messages in a gmail account. It is written in Perl and uses the following modules:
- LWP::UserAgent (required)
- XML::Twig (required)
- Crypt::SSLeay (required)
- DateTime:Format::ISO8601 (optional, for time formatting)
It works by logging into gmail's new mail atom feed via SSL and parsing the xml. It displays the sender, subject, and sent time for each new message found.
Usage
You can hard code your gmail username and password into the script or provide them on the command line:
gmail.pl user.name password
Note that both of these options have security implications. Hard coding your username/password allows anyone with access to the file to read them. Entering them on the command line exposes the username/password in the process list obtainable via ps.
Example
Here is an example of the output:
$ gmail.pl
From: Roman
Re: [arch-announce] slocate replaced by mlocate
Sent: 2007-11-05 16:54:54Z
If you have the optional DateTime::Format::ISO8601 module installed the sent time will be converted into your local time zone.
Let me know if you have any questions or comments.