visual basic 6.0 barcode generator An Overview of Using JavaMail in Java

Making PDF-417 2d barcode in Java An Overview of Using JavaMail

An Overview of Using JavaMail
PDF-417 2d Barcode Decoder In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
PDF-417 2d Barcode Creation In Java
Using Barcode maker for Java Control to generate, create PDF417 image in Java applications.
JavaMail provides a protocol-independent API for sending and receiving e-mail messages. The API is broken up into several classes that model an e-mail system and abstract the details of the low-level networking protocols such as SMTP and POP. Following is an introduction to the core JavaMail classes you will see used later in this chapter.
Decoding PDF 417 In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
Draw Barcode In Java
Using Barcode drawer for Java Control to generate, create bar code image in Java applications.
javax.mail.Session
Scanning Bar Code In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
PDF417 Creation In C#.NET
Using Barcode maker for .NET Control to generate, create PDF417 image in .NET applications.
The javax.mail.Session class defines a basic e-mail session and manages the configuration options and authentication information used to interact with an e-mail server. This class is the entry point for the JavaMail API and is used internally by several of the other classes.
PDF 417 Creator In VS .NET
Using Barcode drawer for ASP.NET Control to generate, create PDF 417 image in ASP.NET applications.
PDF417 Creation In .NET Framework
Using Barcode creator for .NET framework Control to generate, create PDF 417 image in .NET framework applications.
5: Implementing an E-mail Client in Java
PDF417 Creation In Visual Basic .NET
Using Barcode printer for .NET Control to generate, create PDF 417 image in Visual Studio .NET applications.
GS1 DataBar-14 Generation In Java
Using Barcode printer for Java Control to generate, create GS1 DataBar Expanded image in Java applications.
javax.mail.Store
Make GTIN - 12 In Java
Using Barcode maker for Java Control to generate, create UCC - 12 image in Java applications.
Creating Code 39 Extended In Java
Using Barcode generator for Java Control to generate, create Code 3 of 9 image in Java applications.
The javax.mail.Store class is used to represent a message store, which is analogous to an e-mail account. It also provides the access protocol that is used to store and retrieve messages. Store is abstract, and it is essentially an interface used to access an e-mail account with a given protocol such as POP3 or IMAP.
Generate USPS Confirm Service Barcode In Java
Using Barcode generation for Java Control to generate, create USPS PLANET Barcode image in Java applications.
Barcode Drawer In Objective-C
Using Barcode creator for iPhone Control to generate, create barcode image in iPhone applications.
javax.mail.Folder
Encode Code 128B In Java
Using Barcode generation for Eclipse BIRT Control to generate, create Code 128C image in Eclipse BIRT applications.
Linear Barcode Maker In .NET
Using Barcode maker for .NET Control to generate, create Linear 1D Barcode image in .NET framework applications.
The javax.mail.Folder class represents a mailbox folder for e-mail messages. Folder objects are used to provide a tree-like hierarchy for messages and can contain messages, other folders, or both. Folder objects are also used for deleting messages. Folder is abstract.
Draw Data Matrix 2d Barcode In None
Using Barcode generator for Software Control to generate, create ECC200 image in Software applications.
Encoding GS1 - 12 In None
Using Barcode drawer for Online Control to generate, create UPC-A Supplement 2 image in Online applications.
javax.mail.Message
UPC-A Supplement 5 Creation In None
Using Barcode printer for Font Control to generate, create UPC A image in Font applications.
Recognizing EAN-13 Supplement 5 In VB.NET
Using Barcode reader for .NET Control to read, scan read, scan image in .NET framework applications.
The javax.mail.Message class encapsulates an e-mail message and houses each of a message s fields such as its sender, recipient, date sent, subject, and the content of the message. Message is abstract.
javax.mail.Transport
The javax.mail.Transport class encapsulates the code for sending e-mail messages. This class static send( ) method is used to send the messages. Transport is abstract.
A Simple E-mail Client
The remainder of this chapter develops a simple e-mail client that is capable of sending and receiving text-based messages. This application is useful as is when a minimal e-mail client is needed, but its main purpose is to illustrate the techniques needed to access e-mail through the JavaMail API. It also serves as a starting point for your own e-mail application development. Figure 5-1 shows E-mail Client s window. At the top of the window there is a New Message button for creating new e-mail messages. The center of the window is divided between the table of messages and the message display area. Each message in the table lists its sender, its subject, and the date. When a message in the table is selected, it is loaded into the message display area in the bottom half of the center of the window. The bottom of the window holds the Reply, Forward, and Delete buttons for working with the currently selected message. E-mail Client s application code is divided among the following classes: Class
EmailClient ConnectDialog DownloadingDialog MessageDialog MessagesTableModel
Purpose
Houses the bulk of the application, including code for setting up the GUI and for interfacing with e-mail servers Displays a dialog box into which the user enters the connection settings Displays a dialog box with a Downloading message while e-mail is being downloaded from a server Displays a dialog box used for creating messages Holds the list of messages displayed in the e-mail client s window
The Art of Java
Figure 5-1
E-mail Client s GUI interface
The main class of the application is EmailClient. It contains the code that actually deals with the sending and receiving of e-mail. The remaining four classes support EmailClient. The following sections examine each class in detail, beginning with the support classes.
The ConnectDialog Class
The Connect dialog box, illustrated in Figure 5-2, is displayed when the E-mail Client starts up. This dialog box prompts the user for the settings required to establish a connection to an e-mail server.
Figure 5-2
The Connect dialog box window
5: Implementing an E-mail Client in Java
The ConnectDialog class is shown here. Notice that it extends JDialog:
import java.awt.*; import java.awt.event.*; import javax.swing.*; /* This class displays a dialog box for entering e-mail server connection settings. */ public class ConnectDialog extends JDialog { // These are the e-mail server types. private static final String[] TYPES = {"pop3", "imap"}; // Combo box for e-mail server types. private JComboBox typeComboBox; // Server, username, and SMTP server text fields. private JTextField serverTextField, usernameTextField; private JTextField smtpServerTextField; // Password text field. private JPasswordField passwordField; // Constructor for dialog box. public ConnectDialog(Frame parent) { // Call super constructor, specifying that dialog box is modal. super(parent, true); // Set dialog box title. setTitle("Connect"); // Handle closing events. addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { actionCancel(); } }); // Set up settings panel. JPanel settingsPanel = new JPanel(); settingsPanel.setBorder( BorderFactory.createTitledBorder("Connection Settings")); GridBagConstraints constraints; GridBagLayout layout = new GridBagLayout();
Copyright © OnBarcode.com . All rights reserved.