|
|
@@ -751,6 +751,7 @@ public class ResumesServiceImpl extends ServiceImpl<ResumesDao, Resumes> impleme
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
+// to="18064109218@163.com";
|
|
|
// 1. 读取配置(保留原有逻辑)
|
|
|
String from = commonInfoService.findOne(308).getValue();
|
|
|
String authCode = commonInfoService.findOne(309).getValue();
|
|
|
@@ -843,11 +844,25 @@ public class ResumesServiceImpl extends ServiceImpl<ResumesDao, Resumes> impleme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 6. 发送邮件(保留原有Transport.send方式)
|
|
|
+ // 6. 发送邮件(修复:真正调用发送方法)
|
|
|
message.saveChanges();
|
|
|
+
|
|
|
+ // 使用Transport对象发送邮件
|
|
|
+ Transport transport = session.getTransport("smtp");
|
|
|
+ try {
|
|
|
+ transport.connect(host, 465, from, authCode);
|
|
|
+ transport.sendMessage(message, message.getAllRecipients());
|
|
|
+ log.info("邮件发送成功:resumesId={}, to={}, resumesName={}", resumesId, to, resumesName);
|
|
|
+ } finally {
|
|
|
+ if (transport != null) {
|
|
|
+ transport.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- log.info("邮件发送成功:resumesId={}, to={}, resumesName={}", resumesId, to, resumesName);
|
|
|
-
|
|
|
+ } catch (AuthenticationFailedException e) {
|
|
|
+ log.error("邮件发送认证失败:检查授权码是否正确,from={}, to={}, error={}", from, to, e.getMessage(), e);
|
|
|
+ } catch (MessagingException e) {
|
|
|
+ log.error("邮件发送失败:from={}, to={}, error={}", from, to, e.getMessage(), e);
|
|
|
} catch (Exception e) {
|
|
|
log.error("发送邮件异常:resumesId={}, 异常信息={}", resumesId, e.getMessage(), e);
|
|
|
}
|