@@ -0,0 +1,1268 @@
+package com.example.service.email.decorator;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.springframework.mail.MailException;%0Aimport org.springframework.mail.javamail.JavaMailSender;%0A%0Aimport javax.mail.MessagingException;%0Aimport javax.mail.internet.MimeMessage;%0Aimport java.io.IOException;%0A%0A/**%0A * Mail sender decorator for development environment.%0A * Instead of sending emails just print them to console.%0A * %3Cp%3EALERT: This decorator does NOT propagate calls to next decorators in chain.%0A * So recommended usage is like following:%3C/p%3E%0A *%0A * %3Cpre class=%22code%22%3E%0A *     new AnotherMailSenderDecorator(new ConsoleMailSender(mailSender));%0A * %3C/pre%3E%0A *%0A * @author Michal Vlcek %3Cmychalvlcek@gmail.com%3E%0A */%0A@Slf4j%0Apublic class ConsoleMailSender extends AbstractMailSenderDecorator %7B%0A%0A%09public ConsoleMailSender(JavaMailSender mailSender) %7B%0A%09%09super(mailSender);%0A%09%7D%0A%0A%09@Override%0A%09public void send(MimeMessage mimeMessage) throws MailException %7B%0A%09%09try %7B%0A%09%09%09System.out.println(%22---- START OF EMAIL MESSAGE ----%22);%0A%09%09%09System.out.println();%0A%0A%09%09%09mimeMessage.writeTo(System.out);%0A%0A%09%09%09System.out.println();%0A%09%09%09System.out.println(%22----- END OF EMAIL MESSAGE -----%22);%0A%09%09%7D catch (MessagingException %7C IOException e) %7B%0A%09%09%09LOG.error(%22Error sending to console: %7B%7D%22, e.getMessage());%0A%09%09%7D%0A%09%7D%0A%7D%0A

add console mail sender decorator