tags:

views:

52

answers:

2

Where can I get information about mail storage? For ex. creating new folder in your Yahoo account and saving some important emails in that folder. I want to develop email server in JSP. I dont know JSP, I have to learn & develop it. Please give me information regarding this.

+2  A: 

First of all learn the JavaMail API, so you will be able to communicate with POP3, IMAP and SMTP servers. There are either APIs such as commons-net and commons-email.

Second, learn JSP, a good place to start is the Java EE tutorial

Third, understand the JSP model 2 architechture which emphasizes on the MVC pattern for the web. In short, it means you write most of your logic as Java objects, and let the JSP to handle the UI only. A good place to start is by using the Spring Framework MVC application step-by-step tutorial which is based in the spring framework which I found to be really helpful when building web applications in Java.

David Rabinowitz
+1  A: 

JSP is a view technology which provides a template to write plain vanilla HTML/CSS/JS in and enables interaction with backend Java code with help of taglibs (like JSTL) and Expression Language (EL, those ${} things). I don't see how and why you would create a mail storage in JSP. Keep in mind that writing raw Java code in JSP using scriptlets (those <% %> things) is considered a bad practice. Use a real Java class for that. So is there the HttpServlet class which you can extend to write code logic to control, preprocess and/or postprocess requests from/to JSP files.

Now the mail storage part, firstly you need a mail server. It's required to be able to send/receive emails. Without a mail server you can't do anything with any of the Mail API's (from which I by the way highly recommend to choose the JavaMail API, because it provides both POP3 and SMTP support to retrieve and send mails respectively, the Apache Commons Email is restricted to sending mails only). You can make use of the mail server of your ISP to read and send your own mails, you can make use of the mail server of public mailboxes like Yahoo/Gmail/etc, but you're only restricted to your own account. If you want to have full control over the mail server and be able to create individual mailboxes/addresses/folders and so on, you'll need to install your own mail server, for example Apache James.

Now the business logic, just write normal Java classes which does all the mail reading/sending work with help of the JavaMail API (just create a Javabean class representing an email and read emails into a collection of those Javabeans and send mails with the data gathered from those Javabeans).

Once you got it all to work, next step would be to create Servlet(s) which calls the business logic you've developed based on specific request parameters. Finally create JSP files with forms which submits to those Servlet(s) and/or with tables which displays the data collected by those Servlet(s).

That should be it. To learn JSP/Servlet, I can recommend the Sun Java EE tutorial part II chapters 4-9 and/or Marty Hall's Coreservlets.com tutorials.

Good luck.

BalusC