Created
June 2, 2010 13:55
-
-
Save blister/422395 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # this is the script you would use for generic GMail addresses.. | |
| echo "[email protected]" | |
| echo "--------------------" | |
| curl -u [email protected]:YOUR_PASSWORD --silent "https://mail.google.com/mail/feed/atom" | perl -ne \ | |
| ' | |
| print "Message Count: $1 \n\n" if /<fullcount>(.+?)<\/fullcount>/; | |
| print (($title - 1) . ". $1 ") if /<title>(.+?)<\/title>/ && $title++; | |
| print "(from $1)\n" if /<email>(.+?)<\/email>/; | |
| ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # this is the script you would use for Google Apps based email addresses. | |
| echo "your_email@your_domain.com" | |
| echo "--------------------------" | |
| curl -u your_email@your_domain.com:YOUR_PASSWORD --silent "https://mail.google.com/a/your_domain.com/feed/atom" | perl -ne \ | |
| ' | |
| print "Message Count: $1 \n\n" if /<fullcount>(.+?)<\/fullcount>/; | |
| print (($title - 1) . ". $1 ") if /<title>(.+?)<\/title>/ && $title++; | |
| print "(from $1)\n" if /<email>(.+?)<\/email>/; | |
| ' |
Author
Nice! I didn't know that GMail provided an atom feed, very handy.
Author
Yeah, I was amazed as well. I found this technique in an article on 10 Useful Commandline One-Liners. I made a bunch of tweaks to their style and decided to store my password in the script so that I don't have to keep typing it every time (I run the code on my server, and if that gets hacked, I'm basically screwed anyway... so meh)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to make this a little bit more secure and don't like having your account passwords stored in the file, take out the :YOUR_PASSWORD and this script will prompt you for your password every time you run it.