package com.whyc.controller;
|
|
import com.whyc.dto.MailDTO;
|
import com.whyc.dto.Response;
|
import com.whyc.service.MailService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.mail.MessagingException;
|
|
@RestController
|
@RequestMapping("mail")
|
@Api(tags = "邮件")
|
public class MailController {
|
|
@Autowired
|
private MailService service;
|
|
@ApiOperation("发送邮件")
|
@PostMapping("sendMail")
|
public Response sendMail(@RequestBody MailDTO mailDTO) throws MessagingException {
|
service.sendMail(mailDTO);
|
return new Response().set(1,null,"发送完成");
|
}
|
|
}
|