|
@@ -271,21 +271,7 @@ public class EmailUtil {
|
|
|
public static void senEmail(MailboxInfoDTO mailboxInfoDTO, String emails, File file, JavaMailSender javaMailSender,String htmlText) throws Exception {
|
|
|
logger.info("send email begin .........");
|
|
|
// 根据Session 构建邮件信息
|
|
|
- // 创建一个配置文件,并保存
|
|
|
- Properties props = new Properties();
|
|
|
- // SMTP服务器连接信息
|
|
|
- props.put("mail.smtp.host", mailboxInfoDTO.getHost());
|
|
|
- props.put("mail.smtp.port", mailboxInfoDTO.getPort());
|
|
|
- props.put("mail.smtp.auth", "true");
|
|
|
- props.put("mail.smtp.starttls.enale", "true");
|
|
|
- Session session = Session.getInstance(props,new Authenticator() {
|
|
|
- @Override
|
|
|
- protected PasswordAuthentication getPasswordAuthentication() {
|
|
|
- return new PasswordAuthentication(mailboxInfoDTO.getAccount(),mailboxInfoDTO.getPassword());
|
|
|
- }
|
|
|
- });
|
|
|
- // 根据Session 构建邮件信息
|
|
|
- MimeMessage message = new MimeMessage(session);;
|
|
|
+ MimeMessage message = javaMailSender.createMimeMessage();
|
|
|
// 创建邮件发送者地址
|
|
|
Address from = new InternetAddress(mailboxInfoDTO.getAccount());
|
|
|
String[] emailArr = emails.split(";");
|