package com.xwbing.controller.other; import com.alibaba.fastjson.JSONObject; import com.xwbing.annotation.LogInfo; import com.xwbing.service.other.MailService; import com.xwbing.util.JsonResult; import com.xwbing.util.RestMessage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * 项目名称: sb-boot-module-demo * 创建时间: 2017/9/18 13:42 * 作者: xiangwb * 说明:邮件测试控制层 */ @Api(tags = "mailApi", description = "邮件测试相关接口") @RestController @RequestMapping("/mail/") public class MailTestControl { @Resource private MailService mailService; @LogInfo("发送纯文本邮件") @GetMapping("sendSimpleMail") @ApiOperation(value = "发送纯文本邮件") public JSONObject sendSimpleMail() { RestMessage restMessage = mailService.sendSimpleMail("786461501@qq.com", "测试邮件", "收到一个纯文本邮件"); return JsonResult.toJSONObj(restMessage); } @LogInfo("发送html格式邮件") @GetMapping("sendHtmlMail") @ApiOperation(value = "发送html格式邮件") public JSONObject sendHtmlMail() { String content = "" + "
" + "