Using JavaMail in WebSphere Studio

Source: Internet
Author: User
Tags mail resource

Introduction

The Java™mail API enables e-mail clients to send and receive e-mail messages from the mail server. The API provides a platform and protocol-independent framework for building java-based e-mail and messaging applications. The JavaMail API is implemented as an optional Java platform package and can also be used as part of the Java 2 Platform Enterprise Edition (ee).

The focus of this article is to build an application using the JavaMail API and then test the program with Ibm®websphere®studio application Developer (hereinafter called Application Developer). This article also provides information about free e-mail servers and JavaMail scenarios.

If you have experience using the JavaMail 1.1 specification, you will be able to create a mail session with an attribute object. However, for JavaMail 1.2, it is best to find a mail session through JNDI instead of creating a new session through the attribute. Depending on the WebSphere V5 InfoCenter, you should always find a mail session.

The Java EE specification regards a mail session instance as a resource or factory from which you can obtain message transfer and storage connections. Do not hard-code the mail session, which is to fill in the attribute object, and then use it to create an instance of Avax.mail.Session.

Application Developer allows you to use JavaMail without any specific file settings. The only thing that needs to be set is the actual mail session resource.

Application developer does not provide a GUI interface for editing message providers and creating mail sessions. You must complete both tasks directly in the WebSphere Admin console. This article will focus on sending e-mail messages that follow the JavaMail specification.

Prerequisite

Make sure that you have an SMTP mail server available-it is usually provided by your ISP, and you can send e-mail through the SMTP mail server. If you do not know any mail server, you can install your own. A free mail server program that you can download is Postcast server, which transforms your machine into an outbound SMTP mail server. For this article, you can use Postcast server instead of the SMTP server from your ISP.

Installing and configuring the postcast SMTP mail server

Download the installation icon.

Double-click the downloaded file and the system should start the Setup wizard.

Click Next on the Welcome page.

Accept the license agreement, and then click Next.

Specify the installation location, and then click Next:

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.