Properties properties = new Properties();// 创建Properties对象
properties.setProperty("mail.transport.protocol", "smtp");// 设置传输协议
properties.put("mail.smtp.host", "smtp.163.com");// 设置发信邮箱的smtp地址
properties.setProperty("mail.smtp.auth", "true"); // 验证
Authenticator auth = new AjavaAuthenticator(emailName,
emailPassword); // 使用验证,创建一个Authenticator
Session session = Session.getDefaultInstance(properties, auth);// 根据Properties,Authenticator创建Session
Message message = new MimeMessage(session);// Message存储发送的电子邮件信息
message.setFrom(new InternetAddress(fromEmail));
message.setRecipient(Message.RecipientType.TO, new InternetAddress(