Skip to content

Commit

Permalink
Email
Browse files Browse the repository at this point in the history
  • Loading branch information
Throyer committed Nov 9, 2021
1 parent 8b2582e commit 70985bd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
Expand All @@ -32,7 +33,8 @@ public void send(Email email) {
helper.setSubject(email.getSubject());
helper.setText(engine.process(email.getTemplate(), email.getContext()), CONTENT_IS_HTML);
sender.send(message);
} catch (MessagingException exception) {
LOGGER.info("Email enviado com sucesso para: {}", email.getDestination());
} catch (MessagingException | MailException exception) {
LOGGER.error(ERROR_MESSAGE, exception);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, ERROR_MESSAGE);
}
Expand Down

0 comments on commit 70985bd

Please sign in to comment.