mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Update EmailController.java
This commit is contained in:
parent
1831aa1452
commit
493ed6d5a5
@ -2,16 +2,15 @@ package stirling.software.SPDF.controller.api;
|
|||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
||||||
import jakarta.mail.MessagingException;
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -41,15 +40,7 @@ public class EmailController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(consumes = "multipart/form-data", value = "/send-email")
|
@PostMapping(consumes = "multipart/form-data", value = "/send-email")
|
||||||
public ResponseEntity<String> sendEmailWithAttachment(
|
public ResponseEntity<String> sendEmailWithAttachment(
|
||||||
@RequestBody(
|
@Valid @ModelAttribute
|
||||||
description =
|
|
||||||
"Email object containing the recipient's email address,"
|
|
||||||
+ " subject, body, and attachment",
|
|
||||||
required = true,
|
|
||||||
content =
|
|
||||||
@Content(
|
|
||||||
mediaType = "multipart/form-data",
|
|
||||||
schema = @Schema(implementation = Email.class)))
|
|
||||||
Email email) {
|
Email email) {
|
||||||
try {
|
try {
|
||||||
// Calls the service to send the email with attachment
|
// Calls the service to send the email with attachment
|
||||||
|
Loading…
Reference in New Issue
Block a user