Skip to content

Commit 70985bd

Browse files
committed
Email
1 parent 8b2582e commit 70985bd

File tree

1 file changed

+3
-1
lines changed
  • src/main/java/com/github/throyer/common/springboot/domain/services/email

1 file changed

+3
-1
lines changed

Diff for: src/main/java/com/github/throyer/common/springboot/domain/services/email/MailService.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.slf4j.LoggerFactory;
77
import org.springframework.beans.factory.annotation.Autowired;
88
import org.springframework.http.HttpStatus;
9+
import org.springframework.mail.MailException;
910
import org.springframework.mail.javamail.JavaMailSender;
1011
import org.springframework.mail.javamail.MimeMessageHelper;
1112
import org.springframework.stereotype.Service;
@@ -32,7 +33,8 @@ public void send(Email email) {
3233
helper.setSubject(email.getSubject());
3334
helper.setText(engine.process(email.getTemplate(), email.getContext()), CONTENT_IS_HTML);
3435
sender.send(message);
35-
} catch (MessagingException exception) {
36+
LOGGER.info("Email enviado com sucesso para: {}", email.getDestination());
37+
} catch (MessagingException | MailException exception) {
3638
LOGGER.error(ERROR_MESSAGE, exception);
3739
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, ERROR_MESSAGE);
3840
}

0 commit comments

Comments
 (0)