当前位置:   article > 正文

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

java smtpsslserver

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(); // 附件路径信息集合

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/484398
推荐阅读
相关标签
  

闽ICP备14008679号