gmail-lite for PHP
Introduction
gmail-lite is an html-only interface of GMail. Although I develope it with PDA browser (mostly Netfront) in mind, it should be workable with any browser on Earth (e.g. lynx, ie3, netscape4, opera5... by the way, you may be interested in Peter-Paul Koch's excellent article: A History of Browsers). The only tags being used are A, B, FORM, H1, I, INPUT, P, SELECT, TEXTAREA, TABLE, TR, and TD (and META and STYLE in HEAD).
You can also see it as a kind of "example" application that uses the GMailer library.
Features
- Plain html only. Not a single line of javascript is used (at the exact opposite side of the spectrum of official GMail!)
- One page summary for all standard boxes and labels.
- One click for a list of unread conversations (oh, should I patent it?)
- Read, check and compose gmails in conversations and labels, which are all still there.
- Paged threads, collapsed conversation. All still "work" here.
- Reply to a conversation by a simple click.
- Add addresses to the to, cc and bcc fields by simply selecting them from a list. Use click/Ctrl-click/Shift-click to select a list of 100 addresses instead of typing them! (This is probably the most most-wanted feature of GMail...)
- Read the original message (with header info.) in case your browser displayed all kinds of Unicode garbage.
- Full search ability as in GMail, and search results come with "preview" (or called snippet according to them).
- Perform actions on messages, including: label-applying/label-removing/(un)star-ing/archiving/deleting, etc.
- Reading/saving/resuming/discarding drafts!
- Trash individual message within a conversation.
- A configurable, simple color theme for a touch for customization.
- [new] Send invites to your friends! Massively send up to 10 invites at the same time (if you have that many)!
- [new] An option to view HTML-formatted email in their full HTML format.
- [updated] Full attachment support: uploading/attaching and receiving/downloading.
What's Not (yet)
Modify filter/contacts; draft with attachment... what else is essential?
Screenshots
Click here for screenshots of gmail-lite in Netfront (a PDA browser), Opera in Symbian phone, Lynx (a text-only browser on Unix), and some really old browsers.
Demonstration
Demo site 1
Okay, if you got a GMail account, and you really trust me, you may want to try it here. But please note that:
- It is running in a poor, cheap server, which is behind my school's network/infrastructure/firewall. So please do not expect high performance, especially those oversea (the server is in Hong Kong, China, Asia).
- Honestly, it is my server that runs research simulations for me (!!). I would probably just shut down Apache if I have to run some CPU-intensive tasks...
- Please do not make it your primary way to check gmail. Just give it a try, and install it on your own server if you really like it.
- Actually, if you really treasure your GMail account, you shouldn't give other parties your gmail username and password (that's why I coded mine, lol).
- Okay... there's not much design in that pages. Dumb and boring colors, no logos, and a strange layout! But remember it is targeted for PDA browser (e.g. Netfront) and GPRS. A 320x320 screen and bandwidth of 9600bps won't give you too much rooms for eye-catchy. If you found the layout really weird, try reducing the size of browser window.
- Please ALWAYS remember to logout, as you do with the GMail.
- Although I always try my best to keep my code invulnerable while putting a lot of features in it, there is definitely some bugs and/or security holes in my code. Please, if you think you've found one, tell me.
Okay you may really try it here (SSL), :-D. Please send me comments (sorry the address is malformed to avoid spam).
Demo site 2
Sam Krupa is kind enough to host another gmail-lite demo site in his GMail blog for the general public! Thank you, Sam!
Logo/Button
Jay Allen has sent me this nice gmail-lite little button he has created. You may add that to your site if it hosts gmail-lite too. Thank you, Jay!
Changelog
- 0.8a (22 Feb 2005)
- Fixed bug: draft editing/saving did not work.
- 0.8 (22 Feb 2005)
- Fixed bug: "cannot modify header..."
- New feature: send invites, up to 10 in one shot (if you have that many).
- New feature: download all attachments as a zip file.
- New feature: display HTML-formatted email and external images.
- 0.7a (17 Jan 2005)
- Fixed a major bug caused by an update of the Gmail login protocol.
- 0.7 (28 Nov 2004)
- Bug fixed: support labels with space.
- Bug fixed: can really delete spam now! Everyone hate spam.
- Bug fixed: can view mail with simple HTML without problem/distortion.
- New feature: option to show total no. of conversations in summary or not.
- New feature: option to auto-refresh summary page.
- New feature: trash individual message within a conversation.
- New feature: customizable, simple color theme.
- New feature: a new gmail-lite logo :-D
- 0.6 (22 Oct 2004)
- Fixed: compose page contact buttons.
- Fixed: display "\t" as tab.
- Added: draft saving, editing, resuming and discarding.
- 0.56 (21 Sep 2004)
- Proxy server supported.
- Better session/cookie management.
- Fixed diagnose.php .
- Centralized config.php for configuration.
- 0.55 (12 Sep 2004)
- Can perform actions to a conversation in conversation page.
- Shows star and labels of a conversation in conversation page.
- 0.5 (26 Aug 2004)
- Fixed several bugs to make it compatible with php4.
- Included diagnose.php to check if the server is ready for gmail-lite.
Download
The source code of gmail-lite can be accessed via sourceforge. Installation is simple: just copy them all into a directory. Please also see GMailer below for its requirements.
Motivation
GMail is cool, and its extreme use of javascript makes it the coolest webmail on Earth (but again, the credit should be given to Oddpost, which is known as the very first of these heavy-client-side webmail systems). This is why it runs so fast, since most work is done at the client-side. But this prevents people from using different kinds of browsers to access it. Currently only (the most recent versions of) IE, mozilla/firefox, Safari, and probably Opera, are supported.
I would love to check gmail with my PDA while I was, say, waiting for a bus. With GPRS I can go online (almost) anywhere, but I couldn't access GMail. As GMail being my primary email, I felt the need to write an universally accessible version of it. That's how I got the idea of gmail-lite.
I was hacking thimal's RSS feed codes to write my gmail-lite when suddenly, I thought, well, let's wrap those important functions properly into a library. Some time later, I found it very useful and so spent much more time on it than the webmail system. And then I call it GMailer.
Okay, I know Google will probably release POP/IMAP service (update: POP access is available now) or html-only webmail very soon. Since they are definitely doing it better than I have, this project is doomed... but hell, I can't wait. I want to check gmail with any browser, even lynx, now. Besides it is quite an amusement to do such coding... code for what you need, lol.
Notes
GMail is a still in beta, and GMailer (along with gmail-lite above) is, I would say, an "alpha hack" of a beta software. So don't expect it to work all the time, and do not build critical mission applications upon it (e.g. hmm... whatever you think is important). Just have some fun, build something interesting from it, and hopefully make your life a bit easier sometimes. ;-)
Google is, IMHO, a good company. But she is NOT a charity. So let them make some pennies by accessing GMail through its official website, see some text ads, and click on them when you find them really useful or related (but don't click blindly: you will be misleading the "market"). That's how to make a good company stronger.
Finally, please just bear in mind that these kinds of hacking are actually violating their terms of service... so... hey, you were warned.
Support
Please email me or visit the forum at sourceforge.
Sourceforge 
Both GMailer and gmail-lite are submitted as part of the sourceforge project gmail-lite. They are both GPL licensed, i.e. you can use them as long as you are willing to share your code and improvement... (am I right?)
libgmailer for PHP
Introduction
libgmailer (GMailer) is a PHP library/class that helps you accessing/checking/using GMail through PHP scripts.
Basically, GMailer connects to GMail website and does the information retrival on behalf of you. It uses the curl extension of PHP to handle HTTP/HTTPS traffic.
Features
- Database-like accessing of GMail (calling methods like connect(), fetch(query), getSnapshot(), disconnect(), etc.)
- Fetch labels, threads, conversations, messages, message headers and even contact list information. Store them in a human-understandable object ("Snapshot") that you can use with ease.
- Support all the kinds of searches available in GMail (e.g. "is:unread OR has:attachment").
- Compose and send gmail, with the ability to reply to a conversation.
- By using cookies (actually, re-directing GMail's cookies to the client browser), you do not need to login (i.e. send username and password) every time you have called connect() or done something with GMailer.
- Pure SSL transmission.
- Download/send attachments.
- Perform actions on messages, including: label-applying/label-removing/(un)star-ing/archiving/deleting, etc.
- (okay, yet to be implemented) contact list editing, label/filter editing... :P
Download
The latest version can be downloaded from sourceforge. Please send me comments (sorry the address is malformed to avoid spam).
Requirement
GMailer should works well with PHP >= 4. Although I spent most of my time developing it in PHP 5 environment, I took special care not to use classes/functions that are PHP 5 only. Also it requires the curl extension. You may find information about curl in the PHP homepage and the curl homepage.
Because GMailer ALWAYS connects to GMail via SSL, you may need OpenSSL for curl to talk SSL. Details can also be found in curl homepage.
Potential Application
html-only gmail (see gmail-lite below), RSS feed, file server, p2p sharing (-_-! well...), you name it.
Support
Please email me or visit the forum at sourceforge.
Acknowledgement
GMailer is definitely not built completely from scratch. These are the most important projects that have helped me a lot during development:
- GMail RSS feed in PHP by thimal, which is based on Ilia Alshanetsky's project about turning GMail into an online backup system (file server?). Here's where I got the idea of using curl (instead of, painstakingly, fopen and fsockopen).
- Gmail Agent API by Johnvey Hwang, which is a .NET library for you to create .NET application to access Gmail. Its code helps in the deciphering the format of those "data packets" used by Gmail javascript.
About me
Arr... thank you for being so kind to read through the entire page (I assume most of you would simply Ctrl-F & "download" & head for downloading... lol). Here are some interesting pointers about me:
- My personal homepage. Haven't put much details in it though. Yes, it's heavily-javascripted!
- Ganux, a Linux console "simulator", written entirely in javascript. It is actually quite complete, even with its own filesystem! This is now, in fact, being changed into a game, whose goal is to "hack" into (i.e. gain root of) it. Yes again it's heavily-javascripted!
- My blog... hey, wait, I don't do any blogging! :-P
- My school, Hong Kong University of Science and Technology.
- My post-grad studies supervisor's homepage. LOL! This is intended to increase his page rank in Google :-D.