Interface SimpleMessageListener

All Known Implementing Classes:
Wiser

public interface SimpleMessageListener
This is an interface for processing the end-result messages that is higher-level than the MessageHandler and related factory. While the SMTP message is being received, all listeners are asked if they want to accept each recipient. After the message has arrived, the message is handed off to all accepting listeners.
Author:
Jeff Schnitzer
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(String from, String recipient)
    Called once for every RCPT TO during a SMTP exchange.
    void
    deliver(String from, String recipient, InputStream data)
    When message data arrives, this method will be called for every recipient this listener accepted.
  • Method Details

    • accept

      boolean accept(String from, String recipient)
      Called once for every RCPT TO during a SMTP exchange. Each accepted recipient will result in a separate deliver() call later.
      Parameters:
      from - is a rfc822-compliant email address.
      recipient - is a rfc822-compliant email address.
      Returns:
      true if the listener wants delivery of the message, false if the message is not for this listener.
    • deliver

      void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException
      When message data arrives, this method will be called for every recipient this listener accepted.
      Parameters:
      from - is the envelope sender in rfc822 form
      recipient - will be an accepted recipient in rfc822 form
      data - will be the smtp data stream, stripped of any extra '.' chars. The data stream is only valid for the duration of this call.
      Throws:
      TooMuchDataException - if the listener can't handle that much data. An error will be reported to the client.
      IOException - if there is an IO error reading the input data.