从Gmail获取用户的未读邮件

I want to fetch unread mails from user's gmail account and send the notification via SMS. I have complete setup for sending SMS. I just need to know how can I fetch unread mails from Gmail, is there any API for this ? what tools I need ?

I hope its help you to start, great link about Check your unread Gmail from the command line

 curl -u username --silent "https://mail.google.com/mail/feed/atom" |
 perl -ne 'print "\t" if /<name>/; print "$2
" if
 /<(title|name)>(.*)<\/\1>/;'

i tried it before some months and its work fine!

I would just pull from the Imap4 or pop3 interface provided by Gmail.

However the user will have to have Imap/Pop3 enabled but I assume that is not a problem.

I assume you will be able to find clients for PHP for either of the two

Use php:imap (http://www.php.net/imap) and do a search for UNSEEN messages.

or check google code if they provide an api for checking the unread messages of a user