commentaires

This commit is contained in:
Hedi MJID 2022-02-01 09:17:11 +01:00
parent aece88e2a8
commit 382b1052d4

View File

@ -20,18 +20,21 @@ public class MailController {
this.service = service; this.service = service;
} }
// Envoi de mail en text brut
@PostMapping("/text") @PostMapping("/text")
public ResponseEntity<String> sendMail(@RequestBody Mail mail) { public ResponseEntity<String> sendMail(@RequestBody Mail mail) {
service.sendMail(mail); service.sendMail(mail);
return new ResponseEntity<>("Email Sent successfully", HttpStatus.OK); return new ResponseEntity<>("Email Sent successfully", HttpStatus.OK);
} }
// Envoi de mail au format HTML
@PostMapping("/html") @PostMapping("/html")
public ResponseEntity<String> sendMailHTML(@RequestBody Mail mail) throws MessagingException { public ResponseEntity<String> sendMailHTML(@RequestBody Mail mail) throws MessagingException {
service.sendMailHTML(mail); service.sendMailHTML(mail);
return new ResponseEntity<>("HTML mail sent successfully", HttpStatus.OK); return new ResponseEntity<>("HTML mail sent successfully", HttpStatus.OK);
} }
// Envoi du mail avec une piece jointe
@PostMapping("/attachment") @PostMapping("/attachment")
public ResponseEntity<String> sendAttachmentEmail(@RequestBody Mail mail) throws MessagingException { public ResponseEntity<String> sendAttachmentEmail(@RequestBody Mail mail) throws MessagingException {
service.sendMailWithAttachments(mail); service.sendMailWithAttachments(mail);