Javamail Api 简明教程

JavaMail API - Sending Emails

现在,我们对 JavaMail API 及其核心类有了比较清晰的了解。下面,我们编写一个简单的程序,将发送一封简单邮件、一封带有附件的邮件、一封包含 HTML 内容的邮件和一封带有内嵌图片的邮件。

Now that we have a fair idea about JavaMail API and its core classes, let us now write a simple programs which will send simple email, email with attachments, email with HTML content and email with inline images.

上述所有场景中遵循的基本步骤如下:

Basic steps followed in all the above scenarios are as below:

  1. Get the Session object.

  2. Compose a message.

  3. Send the message.

在以下各节中,我们展示了以下简单的示例:

In the following sections we have demonstrated simple examples of: