1 / 41

WAP and E-mail

WAP and E-mail. by Neeraja Gudipati. Contents. Introduction to E-mail Introduction to WAP Why WAP and E-mail? The Mail Process Programming E-mail WML class A WAP-based E-mail Application. E-Mail. E-mail is an asynchronous message exchange technology.

Télécharger la présentation

WAP and E-mail

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WAP and E-mail by Neeraja Gudipati

  2. Contents Introduction to E-mail Introduction to WAP Why WAP and E-mail? The Mail Process Programming E-mail WML class A WAP-based E-mail Application

  3. E-Mail • E-mail is an asynchronous message exchange technology. • E-mail is a way for computer users to exchange messages, as long as there are networks such as the Internet connecting them. • E-mail the ‘killer app’ of the internet is more frequently used than even the web.

  4. WAP Wireless application protocol (WAP) is an application environment and set of communication protocols for wireless devices designed to enable manufacturer-, vendor-, and technology-independent access to the Internet and advanced telephony services.

  5. Why E-mail and WAP? • E-mail and WAP are fast becoming the most demanded combinations of technology by both corporations and general consumers. • There were 569 million e-mail accounts globally at year-end 1999. • It is predicted that there will be in excess of one billion e-mail accounts worldwide by 2002. • There are currently 300 million mobile subscribers, growing at 50% per annum • WAP penetration into the mobile phone market is predicted to be 8% in 2000, 22% in 2001, 50% in 2002 and 85% in 2003.

  6. The Mail Process Important mechanisms in the mail transport system: Mail User Agent(MUA) - A program used to create and receive mail messages. Mail Transfer Agent(MTA) - The means by which mail messages are transferred between machines over the internet Mail Delivery Agent(MDA) - The mechanism that delivers the mail message to the recipient’s mailbox when mail is delivered via an MTA to the mail server

  7. Protocols used • There are two types of protocol used in the e-mail process: • Transport Protocols - Example: SMTP/ESMTP • Storage and Retrieval protocols - Example: POP3/IMAP4

  8. A Typical E-Mail System SMTP/E-SMTP POP3/IMAP Mail Backbone SMTP/E-SMTP Mail Server Mail Server Mail Server LDAP Query Mail User Agent Directory Services

  9. Transmission path of e-mail Submission E-SMTP Delivery File I/O Retrieval POP/IMAP Transmission E-SMTP Recipient Mail User Agent (MUA) Sending Mail Transfer Agent (MTA) Sender Mail User Agent (MUA) Destination Mail Transfer Agent (MTA) INBOX Mail Delivery Agent (MDA) Message Store

  10. Programming E-mail • The Major API sets used to construct the Messaging Applications: • Common Mail Calls • Vendor Independent Messaging • CDO and CDONTS • JavaMail

  11. JavaMail: • JavaMail is platform-independent and protocol-independent, and therefore presents an ideal way to build e-mail and messaging solutions that will work with WAP technology • Advantages: • It is available on the majority of current operating systems • It offers an e-mail API that is both flexible and easy to use • It offers excellent networking capabilities as standard

  12. WML Class • Encapsulates the details and logic needed by the servlet to generate a correctly formed WML page to send as the response to the user’s WAP browser request • WML class models the formatting and header information needed to produce a valid WML document. • Makes the generation of WML easier. • Separates some of the WML syntax logic from the Java servlet code.

  13. WML Class Important Member Functions /*Attributes Stringbuffer buffer; static final int deckSize = 1024 */ /* Adds the card which has its id = iD to the deck*/ public void addCard(String iD) /*Ends the card tag*/ public void endCard()

  14. Member functions (contd.) /*println appends the string line to the buffer of the WML class*/ public void println(String line) /*outputWML gets the writer of the response and writes the contents of the buffer*/ /* if the disableCaching is true the caching of WAP pages is disabled */ public void outputWML(HttpServletResponse response, boolean disableCaching)

  15. WAP-based E-mail application --WAPMail • Implements a simple WAP mail system, allowing access to an SMTP/POP3-based e-mail account • Uses Java Servlets and JavaMail to: • Compose, send and reply to mail via a SMTP server • View an inbox and read mail using a POP3 service • Determine the number of messages waiting in the inbox • Delete mail

  16. WAPMail’s Functionality Login Screen Splash Screen Main Menu Compose Delete View inbox Send Read Item Reply

  17. WAPMail.java /* import statements */ import java.io.*; import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.servlet.*; import javax.servlet.http.*; //WAPMail extends HttpServlet import com.wrox.util.WML; // WML class uses WML tags

  18. WAPMail.java(contd.) public class WAPMail extends HttpServlet implements SingleThreadModel{ /* Attributes */ private static String inboxString = “INBOX”; private static UserSessionData _userSessionData;

  19. WAPMail.java(contd.) /* Member Functions*/ public void doPost(HttpRequest request, HttpServletResponse response){ /* GET the session data */ UserSessionData userSessionData = getUserSessionData(); /* GET the action */ String action = request.getParameter(“action”);

  20. doPost Function /* SHOW SPLASH SCREEN */ if((action == null) || ((!action.equalsIgnoreCase(“login”)) &&(userSessionData == null))){ this.splashScreen(request,response,””); } /* LOGIN */ else if (action.equalsIgnoreCase(“login”)){ this.login(request, response); } // Similarly making decision for LOGOUT , SHOW MAIN MENU, //COMPOSE, SEND , VIEW INBOX , READ, DELETE , REPLY and //calling the corresponding functions } /* end of doPost Function */

  21. splashScreen Function public void splashScreen(HttpServletRequest request, HttpServletResponse response, String message) { /* Create an object of WML */ WML wml = new WML(); /* Add the card with id = WAPMailSplash */ wml.addCard("WAPMailSplash"); /* create a label Login, click activates the task */ wml.println(“<do type = “accept” label = “Login”>”); /* in the case of the click action go the source of request */ wml.println(“<go href = “” + request.getRequestURI() + “” method = “post”>”); /* post the request with action value = login */ wml.println(“<postfield name= "action" value= "login"/>”);

  22. splashScreen Function(contd.) // include postfield tags for posting uid and pwd wml.println(“</go> + </do>”); if(message != null){ /* generally true when there is an error */ //print the message } wml.println(“<p>” + “Username:” ); wml.println(“<input name=“uid” title=“user name”/> <br/>”); wml.println(“Password:”); wml.println("<input name="pwd" type="password" title="password"/><br/>” + “</p>”); wml.endCard()’ wml.outputWML(response, true); } /* end of splashScreen */

  23. Screen shot sequence of login process

  24. login Function public void login(HttpServletRequest request, HttpServletResponse response){ /* Get username */ String username = request.getParameter(“uid”); /* Get password */ String password = request.getParameter(“pwd”); // Get SMTP Session // Get POP3 Session // Get POP3 Store

  25. login Function(contd.) // Create a new UserSessionData object // if everything is ok show main menu this.mainMenu(request, response, usd) /* where usd is userSessionData */ } /* end of login function */

  26. mainMenu Function public void mainMenu(HttpServletRequest request, HttpServletResponse response, UserSessionData userSessionData){ WML wml = new WML(); /*Add the card with id = WAPMailMainMenu with the title Main Menu */ wml.addCard("WAPMailMainMenu", "Main Menu"); wml.println("<anchor>1. Read Mail ”); /* print the total number of messages in the inbox */ wml.println(this.getInboxCount(userSessionData)); wml.println(“<go href = request.getRequestURI());

  27. mainMenu Function(contd.) wml.println(“?action=viewinbox"/>”); wml.println(“</anchor><br/>”); // Similar code for // 2. Compose, action = compose // 3. Logout , action = logout wml.endCard(); wml.outputWML(response, true); } OUTPUT:

  28. viewInbox Function public void viewInbox(HttpServletRequest request, HttpServletResponse response, UserSessionData userSessionData){ /* Get the inbox Folder */ Folder folder = userSessionData.getPop3Store().getFolder(inboxString); /* Open the Folder in the READ_ONLY mode */ folder.open(Folder.READ_ONLY); /* Get Directory */ Message message[] = folder.getMessages();

  29. viewInbox Function(contd.) /* Get the number of messages in the folder */ int n = message.length; WML wml = new WML(); wml.addCard("WAPMailViewInbox"); /* print inbox with the left alignment */ wml.println("<p align="left">"); wml.println("Inbox:<br/>");

  30. viewInbox Function(contd.) // for each message print the From address , print the subject // provide an anchor tag and go tag for read and delete to //link read and delete to their corresponding functions wml.endCard(); wml.outputWML(response, true); /* Close connection */ folder.close(false); }

  31. read Function public void read(HttpServletRequest request, HttpServletResponse response, UserSessionData userSessionData){ // Get Folder i.e folder // Get Message i.e. message /* Get Content */ Object messageContent = message.getContent(); WML wml = new WML(); wml.addCard(“WAPMailReadMail”);

  32. read Function(contd.) /* print From: ,the from address , the subject */ String emailAddress = ((InternetAddress)message.getFrom()[0]).getAddress(); wml.println("<p align="left">" + "From: " + emailAddress + "<br/>" + message.getSubject() + "<br/>" );

  33. read Function(contd.) /* print the content of the mail if it is of type plain text else print error */ if(message.isMimeType(“text/plain”)&& messageContent instanceof String){ wml.println((String)messageContent); }else{ wml.println(“Error! WAP Mail can only read plaintext e-mails”); }

  34. read Function(contd.) //provide an anchor tag and go tag for // reply,delete, mainmenu and viewinbox wml.endCard(); wml.outputWML(response, true); folder.close(false); } // end of read function OUTPUT:

  35. logout Function public void logout(HttpServletRequest request, HttpServletResponse response){ /* destroy the session data */ this.getUserSessionData().destroy(); /* make the session data null */ this. _userSessionData = null; /* create a new WML object */ WML wml = new WML(); /* Add the card with id = WAPMailSplash */ wml.addCard("WAPMailLogout");

  36. logout Function(contd.) wml.println("<p align="left">" + "Thank you for using WAP Mail<br/>" + "<anchor>Restart E-mail" + "<go href="" + request.getRequestURI() + ""/>" + "</anchor>" + "</p>"); wml.endCard(); wml.outputWML(response, true); } /* end of logout function */ } /* end of WAPMail class */

  37. Other Functions • public void compose(HttpServletRequest request, HttpServletResponse response, String to, String subject) • public voidreplyToMessage(HttpServletRequest request, HttpServletResponse response,UserSessionData userSessionData) • public void deleteMessage(HttpServletRequest request, HttpServletResponse response,UserSessionData userSessionData) • public void send(HttpServletRequest request, HttpServletResponse response, UserSessionData userSessionData)

  38. Enhancements to WAPMail • Use HttpSession tracking to allow multi-user access to WAPMail. • Allow the user to specify the POP3 and SMTP servers, perhaps allow for multiple accounts to be read. • If the e-mail contains illegal WML characters, then the e-mail text needs to be parsed to ensure that we encounter no problems.

  39. Future The ultimate goal for messaging technology is a universal inbox in which voice, fax and e-mail can be viewed in any format by a mobile communicator device.

  40. References • http://www.allnetdevices.com/developer/tutorials/2000/08/ 08/wap_and.html • http://www.allnetdevices.com/developer/tutorials/2000/08/ 15/wap_and.html • http://www.allnetdevices.com/developer/tutorials/2000/08/ 21/wap_and.html • http://www.allnetdevices.com/developer/tutorials/2000/09/ 05/wap_and.html • www.w3schools.com/wap

  41. QUESTIONS ?? E-mail : gudipati@csee.wvu.edu

More Related