Using JavaMail in a JSP

Source: Internet
Author: User
Tags documentation html form mail

What is JavaMail?

JavaMail is a sun-released API for handling emails. It makes it easy to perform some common message transfers.

Although JavaMail is one of the Sun's APIs, it has not yet been added to the standard Java Development Toolkit (Java Development Kit), which means that you must download the JavaMail file separately before you use it. In addition, you will need to have Sun's JavaBeans activation Framework (JAF). The operation of the JavaBeans activation framework is complex, and it is simple to say that JavaMail's operation must depend on its support. The path to specify these files is used under Windows 2000 and is similar on other operating systems.

The next thing to explain is the most difficult part of this guide.

This guide includes three parts: HTML tables, a combination of JavaMail, JavaMail, and JSP.

Part I: HTML tables

The first part provides an example of the most basic HTML-based email delivery procedure. The second part tells about the working principle of javamail. The third part introduces the JavaMail to add the JSP, create a basic email send to receive the program.

Dividing components

The most important feature of JSP is the ability to divide the entire Web page into small components. The components used here include:

An HTML form used to send email messages to the JSP;

A JSP page is used to process and send letters.

The first step is to create an HTML table to send information to the JSP page. You can copy the following HTML code to your computer:

The HTML source code used to send email

To: From: Subject: Message:

The above program will create a file that contains basic email information such as your Inbox address, send address, subject, and content. You can, of course, decide on your own needs to include that information.

The use of this HTML file has two requirements: The 1th is that the generated file must be sent to the program that will be introduced next. In this case it is sendmail.jsp, but when you use it, you must replace it with the URL of the file in the system, and the 2nd is that there must be room to allow the user to send email.

The second part will analyze the characteristics of javamail and prepare the JSP program in the third part. So next we will learn javamail.

Part II: About JavaMail
Use of documents

The documentation that is available in the downloaded JavaMail API is useful. You can find it in the/docs/javadocs/index.html under the JavaMail. The second part mainly analyzes the components of the mail program. You can read the documentation to get more information on this.

Component to send mail requires the use of javamail, which makes the operation of the message simple and easy.

Property Object

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.