Remote mailbox access Remote mailbox access gatewaygateway
Software lab projectSoftware lab project
IntroductionIntroduction
In our days email is one of the most In our days email is one of the most popular ways of communication. popular ways of communication.
There are thousands of e-mail service There are thousands of e-mail service providers over the world and millions of e-providers over the world and millions of e-mail users. And the numbers are mail users. And the numbers are constantly growing. Such a popularity constantly growing. Such a popularity encourages development of a large variety encourages development of a large variety of e-mail clients.of e-mail clients.
Today two main approaches for accessing Today two main approaches for accessing e-mail accounts by users are in use. Let’s e-mail accounts by users are in use. Let’s take a look at them: take a look at them:
The classical approachThe classical approach
This is the most straight-forward This is the most straight-forward approach. The server is a pure approach. The server is a pure POP3/SMTP server and in order to POP3/SMTP server and in order to communicate with it the user needs communicate with it the user needs some special e-mail client software some special e-mail client software (MS Outlook, The Bat, Mozilla, etc.)(MS Outlook, The Bat, Mozilla, etc.)
Client computer
E-Mail Server
POP3 / SMTP
E-Mail Client
software
The classical approach cont.The classical approach cont.
In a case, when the user reads In a case, when the user reads his mail from only one, secure his mail from only one, secure computer (at home or at work), computer (at home or at work), this approach is the best one, this approach is the best one, but... but...
The classical approach problemThe classical approach problem
Problem appears when the user want Problem appears when the user want to read his mail when he is away from to read his mail when he is away from his own computer, but has access to a his own computer, but has access to a public computer:public computer:• Using the mail client software on such Using the mail client software on such
computers may be unsafe for the user’s computers may be unsafe for the user’s privacy (account information is saved on privacy (account information is saved on the computer).the computer).
• User may have to set up a lot of settings User may have to set up a lot of settings before he can actually read his mail.before he can actually read his mail.
The HTTP-Mail approachThe HTTP-Mail approach
The partial solution to the public The partial solution to the public computers problem, is provided by some e-computers problem, is provided by some e-mail services by adding to their server mail services by adding to their server some web interface, that can be accessed some web interface, that can be accessed using only the web browser, installed on using only the web browser, installed on every internet-connected computer.every internet-connected computer.
Client computer
E-Mail Server
HTTPWeb
Browser
The HTTP-Mail approach cont.The HTTP-Mail approach cont.
Advantages of such approach:Advantages of such approach:• No need for user to save any account No need for user to save any account
information on the public computer.information on the public computer.• User should only navigate to the mail User should only navigate to the mail
service web page, login and read his service web page, login and read his mail.mail.
• User gets friendly user interface that User gets friendly user interface that can be easily changed and upgraded by can be easily changed and upgraded by the developersthe developers
The HTTP-Mail approach problemThe HTTP-Mail approach problem
The solution is good, but it’s The solution is good, but it’s implemented only by few mail implemented only by few mail providers (The classic examples are providers (The classic examples are Hotmail, Yahoo etc..). Hotmail, Yahoo etc..).
But… What to do when the user has But… What to do when the user has a mail account from some other a mail account from some other providers, who does not have web providers, who does not have web interface ?interface ?
The proposed solutionThe proposed solution
The proposed solution is some kind of mix between the The proposed solution is some kind of mix between the previous approaches it is achieved by the following ideas:previous approaches it is achieved by the following ideas:
Place between the e-mail server and the client computer Place between the e-mail server and the client computer some kind of gateway, capable of communicating with the some kind of gateway, capable of communicating with the mail server via POP3/SMTP protocols, and with the client mail server via POP3/SMTP protocols, and with the client computer, by building a web interface for the mailbox. computer, by building a web interface for the mailbox.
Client computer
E-Mail Server
HTTPWeb
Browser POP3 / SMTP
HTTP POP3/SMTP Gateway
Web Interface
E-Mail Client
The proposed solution cont.The proposed solution cont.
This way we get a lot of benefits:This way we get a lot of benefits:• The server does not have to implement any The server does not have to implement any
web interface( classical approach benefit)web interface( classical approach benefit)• Easy way to check multiply mail Easy way to check multiply mail
accounts( classical approach benefit )accounts( classical approach benefit )• The client needs only the web browser to The client needs only the web browser to
access his mailbox, can access remotely to his access his mailbox, can access remotely to his account with no need to save any account info account with no need to save any account info on the computer he uses( HTTP mail approach on the computer he uses( HTTP mail approach benefit )benefit )
The basic structure of the gatewayThe basic structure of the gateway
Reading mail:Reading mail:• POP3 client – module, capable of connecting POP3 client – module, capable of connecting
and exchanging data with POP3 server.and exchanging data with POP3 server.• MIME parser – module for decoding and MIME parser – module for decoding and
translating to readable form of the data translating to readable form of the data received from the mail server (decoding received from the mail server (decoding messages, extracting attached files, etc.)messages, extracting attached files, etc.)
MIME parser
POP3 Client
SMTP Client
Mail Composer
Web Interface
Reading mail
Sending mail
To mail server
To client
The basic structure of the gateway The basic structure of the gateway cont.cont.
Sending mail:Sending mail:• Mail composer – interface, enabling the user to Mail composer – interface, enabling the user to
create, edit and send e-mail messages (Writing create, edit and send e-mail messages (Writing from scratch, replying, forwarding and from scratch, replying, forwarding and attaching files).attaching files).
• SMTP Client – module, capable of SMTP Client – module, capable of communicating with the SMTP server (mainly – communicating with the SMTP server (mainly – for sending the composed message)for sending the composed message)
The Web Interface – the application-The Web Interface – the application-generated web pages, that the user sees generated web pages, that the user sees in his browser.in his browser.
Tools and technologies usedTools and technologies used The project implemented using ASP.NET The project implemented using ASP.NET
technology. technology. Programming language used is C#.NETProgramming language used is C#.NET The application can be hosted on Microsoft The application can be hosted on Microsoft
IIS web server, running on MS Windows IIS web server, running on MS Windows 2000/XP/2003 server.2000/XP/2003 server.
The application uses SQL database server The application uses SQL database server to host saved user account information to host saved user account information (for some additional features, like an (for some additional features, like an address book, mail server list per user, address book, mail server list per user, etc.)etc.)
Challenges we metChallenges we met Learning new technology and Learning new technology and
programming languageprogramming language Learning and implementing POP3 Learning and implementing POP3
client (there is no built-in POP3 client (there is no built-in POP3 support in .NET Framework.support in .NET Framework.• Logging on/off the mail serverLogging on/off the mail server• Retrieving the list of messagesRetrieving the list of messages• Retrieving the wanted message from the Retrieving the wanted message from the
serverserver• Deleting messagesDeleting messages
Challenges we met cont.Challenges we met cont.
Learning and implementing Learning and implementing rfc822/MIME (standards and rfc822/MIME (standards and specifications for internet mail specifications for internet mail message format) parser.message format) parser.
Challenges we met cont.Challenges we met cont.
• Headers parsingHeaders parsing Parse the message headers and extract all Parse the message headers and extract all
required information about the messagerequired information about the message
Challenges we met cont.Challenges we met cont.
• Decoding the message bodyDecoding the message body Identifying different message partsIdentifying different message parts Decoding the data, if encoded:Decoding the data, if encoded:
• From “Quoted-printable” encodingFrom “Quoted-printable” encoding• From “Base64” encodingFrom “Base64” encoding
Challenges we met cont.Challenges we met cont.
• Multiply languages handlingMultiply languages handling Recognition of the message languageRecognition of the message language Representing the message with correct Representing the message with correct
characters setcharacters set
Challenges we met cont.Challenges we met cont.
• Attached files extractionAttached files extraction Identifying the attachments within the Identifying the attachments within the
message bodymessage body Extracting and decoding the attachmentExtracting and decoding the attachment
Appendix A:Appendix A:Block diagram of the applicationBlock diagram of the application
POP3Client
Messageparser
UserInterface
(ResponseSent to user)
Downloadedmessage
Parsed and processed message
Message list
POP3 commands
Main ASP.NET
Application
Composed message to send
SMTPclient
User accounts database
To POP3 server
To SMTP server
Appendix B:Appendix B:GlossaryGlossary
POP3POP3 – Post Office Protocol, version 3 – the main protocol, – Post Office Protocol, version 3 – the main protocol, used to allow a workstation (client) to retrieve mail that the used to allow a workstation (client) to retrieve mail that the server is holding for itserver is holding for it ..
SMTPSMTP – Simple Mail Transfer Protocol – the main protocol – Simple Mail Transfer Protocol – the main protocol for e-mail transfer and relay across transport service for e-mail transfer and relay across transport service environmentsenvironments
HTTPHTTP – Hypertext Transfer Protocol – the main WWW – Hypertext Transfer Protocol – the main WWW protocol, used, mainly, for transferring the web content in a protocol, used, mainly, for transferring the web content in a form of web pages. form of web pages.
MIMEMIME – Multipurpose Internet Mail Extensions – a set of – Multipurpose Internet Mail Extensions – a set of standards, used for internet message formatting.standards, used for internet message formatting.
RFC RFC – “Request for comments” – a document, describing – “Request for comments” – a document, describing standards and specifications for some format, technology, standards and specifications for some format, technology, etc..etc..