Build your email program on the j2-based Platform

Source: Internet
Author: User
Tags mail account

Build your email program on the j2-based Platform
Jacky Pan
Table of Contents
1. Introduction to the tutorial and installation of Programs
2. Program Structure
3. Interface Design
4. Account Management
5. network connection between the MIDlet and Servlet
6. Servlet and JavaMail
7. simple XML
8. Summary
1. Introduction to the tutorial and installation of Programs
This tutorial describes how to compile a simple email application on the j2-based platform, including the interface design, mail sending/receiving, mail account creation, modification, and deletion, write the backend Servlet.
To run the demo program included in this tutorial, you must install the following software:
1. WTK2.0 (java.sun.com)
2. Apache Tomcat (www.apache.org)
Steps for installing and running the sample program:
1. Download micromail Beta.zip (including source code and binary files) from http://groups.yahoo.com/group/oritec/files)
2. Decompress MicroMail Beta.zip to $ TMP
3. Create a new directory MicroMail under $ WTK/apps
4. Copy $ TMP/src/client/* to $ WTK/apps/MicroMail/src/
5. Copy $/TMP/bin/server/mail. war to $ TOMCAT/webapps/
6. Run Tomcat
7. Run WTK2.0, "Open Project", and select MicroMail
8. Set the URL to the MailAgent address http: // server/mail/MailAgent
2. Program Structure
It adopts the Client-Web Server-Mail Server three-tier architecture, 1.
MIDlet
(Cell Phone)
Servlet
(Web Server)
Mail Server
My Application
Figure 1
Cell Phone sends requests (receive/send emails) to the Web Server, which converts these http requests to POP3 or SMTP Server requests. POP3/SMTP Server executes the corresponding request and returns it to the Cell Phone through the Web Server.
The client (PDA/mobile phone) is a program on the j2's platform. MIDP2 provides some basic network connection APIs. Using these APIs, you can send Http requests to the remote end, receive responses, and transmit data streams.
MailAgent is a Servlet used to receive requests from the client, call the Java Mail API, convert these requests to remote Mail Server requests, and send the Mail Server response to the client.
So why should we adopt this architecture? This is because MIDP2.0 only supports HTTP, but does not support POP3, SMTP, and other application layer protocols. J2EE provides a complete Java Mail API, therefore, you need to use a Servlet to convert an Http request to a POP3 or SMTP request. Another reason is that many carriers may only provide limited network access capabilities, while one agent provides program Deployment flexibility.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.