Class RecordingMailSender

  • All Implemented Interfaces:
    org.springframework.mail.MailSender

    public class RecordingMailSender
    extends ConsoleWritingMailSender
    A MailSender implementation that allows looking up all SimpleMailMessages that have been sent. Will also log the messages as they are received for sending. The required setup steps can be found in ConsoleWritingMailSender's JavaDoc.
    Since:
    6.3.1
    Author:
    Oliver Gierke
    • Constructor Detail

      • RecordingMailSender

        public RecordingMailSender()
    • Method Detail

      • send

        public void send​(org.springframework.mail.SimpleMailMessage simpleMessage)
                  throws org.springframework.mail.MailException
        Specified by:
        send in interface org.springframework.mail.MailSender
        Overrides:
        send in class ConsoleWritingMailSender
        Throws:
        org.springframework.mail.MailException
      • getSentMessages

        public org.springframework.data.util.Streamable<org.springframework.mail.SimpleMailMessage> getSentMessages()
        Returns all SimpleMailMessages that have been recorded so far.
        Returns:
        will never be null.