org.subethamail.smtp
Interface MessageListener

All Known Implementing Classes:
Wiser

public interface MessageListener

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
 boolean accept(java.lang.String from, java.lang.String recipient)
          Called once for every RCPT TO during a SMTP exchange.
 void deliver(java.lang.String from, java.lang.String recipient, java.io.InputStream data)
          When message data arrives, this method will be called for every recipient this listener accepted.
 

Method Detail

accept

boolean accept(java.lang.String from,
               java.lang.String recipient)
Called once for every RCPT TO during a SMTP exchange.

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(java.lang.String from,
             java.lang.String recipient,
             java.io.InputStream data)
             throws TooMuchDataException,
                    java.io.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
Throws:
TooMuchDataException - if the listener can't handle that much data. An error will be reported to the client.
java.io.IOException - if there is an IO error reading the input data.


Copyright © 2011 SubEthaSMTP. All Rights Reserved. Build version: UNVERSIONED