|
|
@@ -1,29 +0,0 @@
|
|
|
-package es.uv.saic.web;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import es.uv.saic.dto.EmailDTO;
|
|
|
-import es.uv.saic.service.EmailService;
|
|
|
-import jakarta.mail.MessagingException;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-
|
|
|
-
|
|
|
-@RestController
|
|
|
-public class EmailController {
|
|
|
- @Autowired
|
|
|
- EmailService es;
|
|
|
-
|
|
|
- @PostMapping("/sendEmail")
|
|
|
- public void sendEmail(@RequestBody EmailDTO email) {
|
|
|
- try {
|
|
|
- es.sendMail(email.getTo(), email.getSubject(), email.getMessage());
|
|
|
- } catch (MessagingException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|