Interface SmtpMessageHandler

All Superinterfaces:
SmtpServerListener
All Known Implementing Classes:
DefaultSmtpMessageHandler

public interface SmtpMessageHandler extends SmtpServerListener
Represents a message handler that will process any incoming message.
  • Method Details

    • messageReader

      Returns a new SmtpMessageReader that loops over the received messages. Note that if you create multiple SmtpMessageReader instances, the will compete over the same message list and the messages will be received only by one of the readers.
      Returns:
      A new SmtpMessageReader instance.
    • readMessages

      List<SmtpMessage> readMessages(long delayIfNoMessage, TimeUnit unit)
      Retrieves the received messages and clears the list. In case there are already some messages returned, this method returns them immediately without waiting.
      Parameters:
      delayIfNoMessage - The delay to wait when there is no message yet received or a negative value to avoid any wait.
      unit - The unit of the delayIfNoMessage.
      Returns:
      All the (newly) received messages or an empty list if none.