|
@@ -7,9 +7,11 @@ import com.fjhx.email.config.exception.ServiceException;
|
|
|
import com.fjhx.email.entity.dto.GetMessagePageDto;
|
|
|
import com.fjhx.email.entity.dto.MailSyncInfo;
|
|
|
import com.fjhx.email.entity.dto.MailboxInfo;
|
|
|
+import com.fjhx.email.entity.dto.SendDto;
|
|
|
import com.fjhx.email.entity.vo.MessageDetailVo;
|
|
|
import com.fjhx.email.entity.vo.MessageVo;
|
|
|
import com.fjhx.email.service.IMailService;
|
|
|
+import com.fjhx.email.utils.EmailUtil;
|
|
|
import com.fjhx.email.utils.HxHttpUtil;
|
|
|
import com.fjhx.email.utils.PageWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -41,15 +43,15 @@ public class MailController {
|
|
|
}
|
|
|
} catch (IORuntimeException e) {
|
|
|
log.error("获取主服务在线用户超时");
|
|
|
- ThreadUtil.sleep(1000 * 5);
|
|
|
+ ThreadUtil.sleep(1000 * 10);
|
|
|
checkStart();
|
|
|
} catch (ServiceException e) {
|
|
|
log.error("主服务返回信息错误:{}", e.getMessage());
|
|
|
- ThreadUtil.sleep(1000 * 5);
|
|
|
+ ThreadUtil.sleep(1000 * 10);
|
|
|
checkStart();
|
|
|
} catch (Exception e) {
|
|
|
log.error("解析错误", e);
|
|
|
- ThreadUtil.sleep(1000 * 5);
|
|
|
+ ThreadUtil.sleep(1000 * 10);
|
|
|
checkStart();
|
|
|
}
|
|
|
}
|
|
@@ -112,5 +114,19 @@ public class MailController {
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 发送邮件
|
|
|
+ */
|
|
|
+ @PostMapping("/sendMail/{host}/{user}/{password}")
|
|
|
+ public R sendMail(@PathVariable("host") String host, @PathVariable("user") String user,
|
|
|
+ @PathVariable("password") String password, @RequestBody SendDto sendDto) {
|
|
|
+ try {
|
|
|
+ EmailUtil.sendMail(host, user, password, sendDto);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("发送邮件失败:", e);
|
|
|
+ throw new ServiceException("发送邮件失败");
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
|
|
|
}
|