测试发送邮件

v1.4.1
hiparker 4 years ago
parent a4644272a4
commit 457f525fe9

@ -9,6 +9,7 @@ import org.opsli.modulars.tools.email.service.IEmailService;
import org.opsli.modulars.tools.email.wrapper.EmailModel; import org.opsli.modulars.tools.email.wrapper.EmailModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/** /**
@ -20,7 +21,7 @@ import org.springframework.web.bind.annotation.PostMapping;
*/ */
@Api(tags = "邮件类") @Api(tags = "邮件类")
@Slf4j @Slf4j
@ApiRestController("/email") @ApiRestController("/tools/email")
public class EmailRestController { public class EmailRestController {
@Autowired @Autowired
@ -33,11 +34,11 @@ public class EmailRestController {
*/ */
@ApiOperation(value = "测试发送邮件", notes = "测试发送邮件") @ApiOperation(value = "测试发送邮件", notes = "测试发送邮件")
@PostMapping("/testSend") @PostMapping("/testSend")
public ResultVo<?> testSend(EmailModel model) { public ResultVo<?> testSend(@RequestBody EmailModel model) {
try { try {
String result = iEmailService iEmailService
.send(model.getTo(), model.getSubject(), model.getContent()); .send(model.getTo(), model.getSubject(), model.getContent());
return ResultVo.success(result); return ResultVo.success("邮件发送成功");
}catch (Exception e){ }catch (Exception e){
return ResultVo.error("邮件发送失败 - " + e.getMessage()); return ResultVo.error("邮件发送失败 - " + e.getMessage());
} }

Loading…
Cancel
Save