25 lines
796 B
Java
25 lines
796 B
Java
package cn.hezhaohui.mail.controller;
|
|
|
|
import cn.hezhaohui.mail.entity.Mail;
|
|
import cn.hezhaohui.mail.entity.Response;
|
|
import cn.hezhaohui.mail.service.MailService;
|
|
import jakarta.annotation.Resource;
|
|
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;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/email")
|
|
public class MailController {
|
|
|
|
@Resource
|
|
private MailService mailService;
|
|
|
|
@PostMapping("/send")
|
|
public Response sendMail(@RequestBody Mail mail) {
|
|
mailService.sendMessage(mail.getTo(), mail.getSubject(), mail.getContent());
|
|
return new Response(200, "success");
|
|
}
|
|
}
|