Case Study of Web Based Email Application Essay

Case Study: Web Based Email Applications With almost ten years of experience in developing state-of-the-art messaging solutions, our research and development team leverages its email market expertise to develop a world-class technology that is highly cost effective and rapidly deployable over millions of emailboxes and domains. http://www. zapzone. com/technology. html http://www. astra. ph/what-we-do/project-showcase/email-rich-internet-application/ Scalable and modular system architecture

Our Web-based email system was designed to provide for maximum flexibility. We have achieved this by developing a unique system architecture which is composed of three main components: web, mail and database servers. Web servers are responsible for the front-end email application, mail servers are responsible for the storage and transmittal of email messages, and database servers are responsible for storing all other important user business partner information. These servers interact through standard protocols such as HTTP, IMAP4, POP3 and SMTP and ODBC.

We will write a custom essay sample on
Case Study of Web Based Email Application Essay
or any similar topic only for you
Order now

The modularity of our network architecture provides several key technological advantages: Cost-effective and Rapidly Deployable Our overall system design significantly reduces our time-to-deploy and costs for each mailbox supported. We host most of our servers through third-party hosting vendors. Economies of scale allow such vendors to offer server hosting facilities and Internet backbone access at bulk rates, which significantly reduces our Internet connectivity and server maintenance costs.

The modularity of our system architecture allows us to choose from among a broad range of industry-standard mail servers. As a result, we can focus on developing value-added email services instead of becoming entrenched with constant modification, upgrades to our server software and internal development efforts. Because third-party mail servers are constantly upgraded with the most advanced features (LDAP support, HTML messaging, etc. ), we reduce our development time by leveraging existing off-the-shelf technology and immediately integrating these features into our service offerings.

Scalable, Reliable System We have integrated into our server network a load-balancing functionality which automatically redirects server load to optimize the overall performance of the system. The modularity of our system architecture allows us to deliver one of the highest service performance levels available today. To provide enhanced scalability, we can seamlessly add additional servers to our network, to match growing capacity demands. Portable As the market for outsourced email systems evolves, some organizations may demand an in-house hosting facility.

The highly modular nature of our system architecture provides us with the ability to duplicate a system in another location within a period of several days. As a result, we are technologically equipped to rapidly deploy email services to this growing subset of the outsourced email systems market. Programming We have custom-built a unique software development language in order to maximize the flexibility and minimize the development time of our email services.

Using this language each business partner can select their own look and feel language and other parameters, while the site is created without having to change the underlying code. Through this software development language, we can: • add new functionality and features (languages, premium services, etc. ) to any business partner’s existing email system in a few hours; • simultaneously upgrade more than one email system (for example, immediately making additional languages available to any end-user of our service); and • make automated email applications available to end-users in very little time)

Sending Emails using JavaServer Pages by Faisal Khan. In this article we will learn how to send plain text emails using JSP pages. Since it is not a good habit to put Java code in JSP pages, we will create a JavaBean to send the emails for us. Why will you need to send emails from your website? Following are just a few reason why you will need to send emails from your website, enterprise application etc : * To put feedback forms on your site, allowing users to easily send comments and suggestions to you regarding the content on your web site. Sending confirmation emails to buyers that the product they bought will be sent to them in this much time. * To program your application in such a way to send you ( the webmaster ) email whenever some thing important goes down on your web site e. g. database server crashes. * To send emails to mailing list. This is a rather important use and I will probably describe it in a separate article. Well, above were only few points which came to my mind, but I know that you understand that you need to have this capability on your web site.

If you are looking for a production ready, stable, easy to use ASP. NET Newsletter application, then look no further: Faisal Khan (the author of this tutorial) has created a great Newsletter Application for you to download and start using today. It is easy to install, lets your users subscribe using a subscription form, provides a simple administration interface to create and send newsletters, handles the task of sending newsletters in the background using thread queues on the server, and lets users unsubscribe if they wish so. Requirements You need to have at least a JSP 1. capable application server or Servlet container. Almost all of the application servers, servlet containers I know are capable of JSP 1. 1 so it shouldn’t be any problem. The least you can do is to download and install Tomcat server. I have explained every step from downloading to installing and running Tomcat server in a separate article. You can read it from there. Next you need to have JavaMail ( mail. jar ) jar file in your application server’s classpath. Download the latest JavaMail 1. 2 jar file from Sun’s JavaMail web site and put it in your server /lib folder.

Most application servers have a “lib” ( stands for library ) folder where you can put the jar files you need your server to know about. If your application server doesn’t have a lib folder, you should consult it’s documentation as to where additional jar files should be put. If nothing works you can at least put the jar file in your web application’s /WEB-INF/lib folder. This should work. Still if nothing works, you can post your question here at the bottom of this article. One last thing you need to have in your application server’s classpath is Java Activation Framework jar ile. You can download it from here. It is needed by the JavaMail class files. Once both activation. jar and mail. jar files are in your server’s classpath or in your web application’s WEB-INF/lib folder, you are ready to move forward. Building the application To demonstrate how to send emails, we’ll create just 4 files : * index. html A simple HTML page which displays a form to you containing few input fields. Here you will enter the sender’s and receiver’s email addresses, subject and message of the email. * mailer. jsp The JSP page which calls the MailerBean to send email.

Since all the work is done by the MailerBean, this JSP page is simpler than you can imagine. * errorPage. jsp An error page which will catch any exceptions thrown by mailer. jsp ( from the MailerBean ) JSP page and show it to the user. Exceptions can be thrown when for instance you enter an illegal receiver’s email address, or simply forget to enter anything in the receiver’s input field. * MailerBean. class The actual bean which does all the hard work of sending emails for us. Advice Just in case if you are wondering that it is taking more effort than you thought as you have to create two extra files; errorPage. sp and MailerBean, you are right. I could have easily cluttered the mailer. jsp page will all the Java code required to send emails but then it’ll be wrong. What if you happen to require sending emails in another JSP page for instance? will you copy all the code from mailer. jsp to that page? you shouldn’t do that. Encapsulating all the code in MailerBean allows us to use this bean from anywhere we want. You can use it from within JSP pages, Servlets, other beans or even EJBs and standalone applications. Using JavaBeans allows a great deal of scalability. The second extra page, errorPage. sp is an error page which will catch the ugly exceptions from within mailer. jsp page show it in a rather friendly environment to the user. I have added this error page here so that you also learn good practices while learing J2EE. To sum up, scalability is the key. If you ever happen to come across a solution which in not scalable, doesn’t matter how good it is, my advice is to stay away from it. i. index. html Create a new folder in your web application folder and give it any name. For example’s sake, I will call this folder “mail”. Now create a new index. tml HTML page in it and copy the following text in it : ;html; ;head; ;style; div,input,textarea { font-family:Tahoma; font-size:8pt; } input. std { width:200; } div. frame { padding-left:70; } ;/style; ;/head; ;body; ;div class=”frame”; ;form action=”mailer. jsp” method=”post”; To :;br; ;input type=”text” name=”to” class=”std”;;/input;;br; From :;br; ;input type=”text” name=”from” class=”std”;;/input;;br; Subject :;br; ;input type=”text” name=”subject” class=”std”;;/input;;br;

Message :;br; ;textarea rows=”10″ cols=”80″ name=”message”;;/textarea; ;br; ;input type=”submit” value=”Send”;;/input; ;/form; ;/div; ;/body; ;/html; As you can see it is a simple HTML page which displays a form to the user containing 3 input and 1 big textarea field. The 2 input fields are for receiver’s and sender’s email address, while the 3rd field is for the subject of the email. ii. mailer. jsp Create a new JSP page and save it as “mailer. jsp” in the same folder as the one in which you placed index. html.

Copy the following code and paste it in mailer. jsp page : ;%@ page errorPage=”errorPage. jsp” %; ;html; ;head; ;style; div,input,textarea { font-family:Tahoma; font-size:8pt; } input. std { width:200; } div. frame { padding-left:70; color:green; } ;/style; ;/head; ;body; ;div class=”frame”; ;jsp:useBean id=”mailer” class=”com. stardeveloper. bean. test. MailerBean”; ;jsp:setProperty name=”mailer” property=”*”/; ;% mailer. sendMail(); %; ;/jsp:useBean; Email has been sent successfully. ;/div; ;/body; ;/html; Explanation

First important thing to notice is the “errorPage” attribute in the “page” directive at the top. It tells the servlet container that this page makes use of an error page so any exception which is thrown in this page should be made available to the error page, where we show it to the user. The other important thing is that the JSP page makes use of the MailerBean. We use the ;jsp:useBean /; tag to tell the servlet container that we are going to use this bean. Next we set all the properties of our MailerBean at once by using the ;jsp:setProperty /; tag and setting it’s property attribute to “*” ( aestrick ).

We can do this only when the HttpServletRequest object ( request ) for this JSP page contains parameter name/value pairs corresponding to the names of the given bean’s ( MailerBean in this instance ) properties. ;jsp:useBean id=”mailer” class=”com. stardeveloper. bean. test. MailerBean”; ;jsp:setProperty name=”mailer” property=”*”/; ;% mailer. sendMail(); %; ;/jsp:useBean; As we’ll see in a moment, our MailerBean exposes 4 properties to be set with names of “to”, “from”, “subject” and “message”.

Accordingly we have built our index. html in such a way that it contains four form field names like the ones exposed by MailerBean i. e. “to”, “from”, “subject” and “message”. When the properties have been set, we call it’s sendMail() method to send the actual email. So as you just saw, mailer. jsp page is a really simple JSP page. Actually had I provided a compiled version of MailerBean to you and not shown you it’s source ( the bean thus acting as a ‘black box’ to you ), you’ll be dancing with joy that how simple it is to send an email from within JSP.

Actually you are not only learning the actual code to send an email but also good habbits of encapsulating re-usable code inside JavaBeans. If you are not sure that you know enough about JavaBeans, please see our JavaBeans column which contains some excellent articles on this topic. iii. errorPage. jsp Create a new JSP page and save it as “errorPage. jsp” in the same folder as the one in which you placed above 2 files. Copy the following code and paste it in errorPage. jsp : ;%@ page isErrorPage=”true” %; ;html; ;head; ;style; div,input,textarea { font-family:Tahoma; font-size:8pt; } input. td { width:200; } div. frame { padding-left:70; color:red; } ;/style; ;/head; ;body; ;div class=”frame”; ;%= exception. getMessage() %; ;/div; ;/body; ;/html; Explanation Our errorPage. jsp JSP page tells the servlet container that it is an error page by setting the “isErrorPage” attribute in the “page” directive at the top to “true”. ;%@ page isErrorPage=”true” %; When it does that, the servlet container makes this page available an “exception” object of type “java. lang. Throwable”. We then use the the methods of this object to display the information to the user.

Like in our case we display the error message to the user by calling getMessage() method. iv. MailerBean. class Now it is time that we create the JavaBean which will do all the work for us. Create a new Java source file MailerBean. java in the /WEB-INF/classes/com/stardeveloper/bean/test folder. Copy and paste the following code in it : package com. stardeveloper. bean. test; import java. io. *; import java. util. *; import javax. mail. *; import javax. mail. event. *; import javax. mail. internet. *; public final class MailerBean extends Object implements Serializable { /* Bean Properties */ private String to = null; rivate String from = null; private String subject = null; private String message = null; public static Properties props = null; public static Session session = null; static { /*Setting Properties for STMP host */ props = System. getProperties(); props. put(“mail. smtp. host”, “mail. yourisp. com”); session = Session. getDefaultInstance(props, null); } /* Setter Methods */ public void setTo(String to) { this. to = to; } public void setFrom(String from) { this. from = from; } public void setSubject(String subject) { this. subject = subject; } public void setMessage(String message) { this. message = message; } /* Sends Email */ ublic void sendMail() throws Exception { if(! this. everythingIsSet()) throw new Exception(“Could not send email. “); try { MimeMessage message = new MimeMessage(session); message. setRecipient(Message. RecipientType. TO, new InternetAddress(this. to)); message. setFrom(new InternetAddress(this. from)); message. setSubject(this. subject); message. setText(this. message); Transport. send(message); } catch (MessagingException e) { throw new Exception(e. getMessage()); } } /* Checks whether all properties have been set or not */ private boolean everythingIsSet() { if((this. to == null) || (this. from == null) || (this. ubject == null) || (this. message == null)) return false; if((this. to. indexOf(“@”) == -1) || (this. to. indexOf(“. “) == -1)) return false; if((this. from. indexOf(“@”) == -1) || (this. from. indexOf(“. “) == -1)) return false; return true; } } How to compile MailerBean ? Assuming that the name of JavaMail jar file you downloaded is mail. jar and it is present in C:yourappserverlib folder, use a command like following at Command Prompt to compile MailerBean : C:;javac -classpath %CLASSPATH%;C:yourappserverlibmail. jar C:;yourappfolderWEB-INFclassescomstardeveloper ean estMailerBean. java

Substitute the C:yourappserverlibmail. jar with the complete address and name of your JavaMail mail. jar file and C:;yourappfolder with the complete address of your web application folder. The point to remember is to make sure that JavaMail mail. jar file is in your classpath when you compile MailerBean or it will not compile. Explanation First line tells that MailerBean belongs to com. stardeveloper. bean. test package : package com. stardeveloper. bean. test; Next we import the libraries we will be needing. import java. io. *; import java. util. *; import javax. mail. *; import javax. mail. event. *; import javax. mail. nternet. *; The we declare our MailerBean as final. Remember a final class is always more efficient than a non-final class. public final class MailerBean extends Object { Then we declare the 4 properties of our bean : private String to = null; private String from = null; private String subject = null; private String message = null; Now we declare two public static attributes. These are not like properties we declared above, these are rather internal variables which you don’t need to change and don’t have getter/setter methods. But I have still made them public so that just in case if you have to set Session or Properties object

×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out