E-MAIL MANAGER


 


INTRODUCTION

E-mail manager is an application that helps a PDA user to view his e-mails from different accounts in one central place. The idea
here is not only to provide convenience but also to save the browsing time and hence the battery power.

This application downloads all the unread e-mails from different mail boxes of the user so that he can read them when offline.
Since wireless modems consume high power , saving browsing time leads to a saving in battery power.

The project is done in embedded Visual C++ and runs under Windows CE operating system. This is a combined effort of Liva
Alim, Kalyan Ayyagari, Dhanashri Garud and Ravi Kondapalli.
 
 
 

IMPLEMENTATION

This project consists of two phases

Phase1 - Downloading unread e-mails from the server

This is implemented using HTTP (Hyper Text Transfer Protocol) .WinINet API in Windows CE provides various functions that allow
the usage of HTTP methods (GET , POST etc..) which help in retrieving the e-mails from different servers.
 

DESIGN
 
 
 
 


 
 
 

To connect to a mail server, the steps are the following:

        1. Declare an Internet handler using InternetOpen();
 

        2. Call InternetConnect() using the HINTERNET returned by InternetOpen() to create an HTTP session;

        3. Append a Query string that includes User name & Password to the server URL that authenticates the login request;

        4. Call HttpOpenRequest() using the above encoded URL to open an HTTP request handle;

        5. Call HttpSendRequest() using the handle created by the HttpOpenRequest() to send a HTTP request to the HTTP server;

        6. Call InternetReadFile() to download data;

        7. Use a while loop to retrieve the mails from the inbox;

        8. Call InternetCloseHandle() several times to close all the handles created above
 
 

The code http.c implements this phase
 

Phase2 - Storing the mail in the message store and displaying it
 
 

FLOW GRAPH

 

   
 
 
 
 

Problems Encountered

1.   Setting Time Stamp:

Time would show up as some weird characters initially when the program was run.The following two functions were used to get around this problem

2.   Memory Leaks:

Memory leaks would occur at the end of the program. MailFree() function was used to free the memory allocated to the mail message
 
 

Functions  Used

To store and display the message, the steps are the following:

 1. MailOpen()  to open  the message store and obtain a handle to the mail context.

2.  Memset() to Set buffer to a specified character

3.  MailPut() to create a new mail entry in the message store

4. MailFirst() to retrieve the first of a specified type of message from a folder in the message store

5. MailSetField() to add, update, or delete fields from the message header

6. MailMessage.dwFlags = MAIL_FOLDER_INBOX  is used to change By changing dwFlags , the destination folder of the e-mail can be selected

7. MailFree() to return storage space back to the system from a previous MailFirst() function

8. MailClose() to release the handle to the current mail context.
 
 

The code which does this can be found here
 

Screen Shots to show an Example