Projects
Projects
Besides web developing, I also have some experience in application development. Here's a list of useful projects:
IMAP Mail Checker extension for Google Chrome
Everybody knows the Google Mail Checker for Google Chrome made by the Chrome team. It displays the amount of unread mail in your Gmail in de top right corner of your browser.
However most people have multiple email accounts to manage and the Google Mail Checker only checks one of those email accounts. That's why I created a generic IMAP Mail Checker for Google Chrome. With this extension, you can check any IMAP email account you want!

The extension is divided in two parts:
- The Google Chrome extension
- A simple PHP file
The Google Chrome extension lets you define the page to open when the icon is clicked and defines the URL which generates the amount of unread email from your inbox.

This works as follows: the PHP file generates a JSON object (data), which contains the amount of unread emails in your inbox (data.count). The Google Chrome extension then sends a AJAX request to acquire this JSON object and parses it to be displayed in your browser.
Howto install the extension
First, download this zip file containing the Google Chrome extension. Unzip it somewhere on your computer and load the extension as follows (Source: Google):
Bring up the extensions management page by clicking the wrench icon and choosing Tools > Extensions. (On Mac, use Window > Extensions.)
If Developer mode has a + by it, click the + to add developer information to the page. The + changes to a -, and more buttons and information appear.
Click the Load unpacked extension button. A file dialog appears. In the file dialog, navigate to your extension's folder and click OK.
If your extension is valid, its icon appears next to the address bar, and information about the extension appears in the extensions page.
Next, make sure you have a server that supports PHP and has the imap-plugin enabled. Copy & paste the following code into a file and host it on your server. Be sure to edit the _HOSTNAME_, _PORT_, _OPTIONS_, _USERNAME_ and _PASSWORD_ variables.
/* connect to inbox */
/* example: {ch.tudelft.nl:993/imap/ssl/novalidate-cert}INBOX
For more info: http://php.net/manual/en/function.imap-open.php */
$hostname = '{_HOSTNAME_:_PORT_/_OPTIONS_}INBOX';
$username = '_USERNAME_';
$password = '_PASSWORD';
/* try to connect */
$inbox = imap_open($hostname,$username,$password,OP_READONLY) or die('Cannot connect to mailbox: ' . imap_last_error());
/* grab emails */
$emails = imap_search($inbox,'UNSEEN');
if ($emails) {
/* create JSON */
$count = sizeof($emails);
$arr = array ('count'=> $count);
header('Content-type: application/json');
echo json_encode($arr);
}
/* close the connection */
imap_close($inbox);
Now get the URL of the PHP page and insert it in the options page of the extension.

Finally if you want different icons, just replace the icon.png's in the extension folder.
And there you have it! An IMAP Mail Checker which works for every email account that supports IMAP!


