java加密发送邮件,JavaMail实现收发邮件(五)使用SSL实现加密传输

package javamail.zifangsky.com;

import java.io.UnsupportedEncodingException;

import java.util.ArrayList;

import java.util.Date;

import java.util.List;

import java.util.Properties;

import javax.activation.DataHandler;

import javax.activation.FileDataSource;

import javax.mail.Address;

import javax.mail.BodyPart;

import javax.mail.Multipart;

import javax.mail.Session;

import javax.mail.Transport;

import javax.mail.internet.InternetAddress;

import javax.mail.internet.MimeBodyPart;

import javax.mail.internet.MimeMessage;

import javax.mail.internet.MimeMultipart;

import javax.mail.internet.MimeUtility;

public class SendMailBySSL {

private final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";

private String smtpServer; // SMTP服务器地址

private String port; // 端口

private String username; // 登录SMTP服务器的用户名

private String password; // 登录SMTP服务器的密码

private List recipients = new ArrayList(); // 收件人地址集合

private String subject; // 邮件主题

private String content; // 邮件正文

private List attachmentNames = new ArrayList(); // 附件路径信息集合

你可能感兴趣的:(java加密发送邮件)