org.subethamail.smtp.server
Class DefaultMessageHandler

java.lang.Object
  extended by org.subethamail.smtp.server.AbstractMessageHandler
      extended by org.subethamail.smtp.server.DefaultMessageHandler
All Implemented Interfaces:
AuthenticationHandler, MessageHandler

public class DefaultMessageHandler
extends AbstractMessageHandler

Default class that extends the AbstractMessageHandler class.

Author:
De Oliveira Edouard <doe_wanted@yahoo.fr>

Nested Class Summary
static class DefaultMessageHandler.Delivery
          Needed by this class to track which listeners need delivery.
 
Field Summary
 
Fields inherited from class org.subethamail.smtp.server.AbstractMessageHandler
SMTP_TERMINATOR
 
Constructor Summary
DefaultMessageHandler(MessageContext ctx, AuthenticationHandler authHandler)
           
 
Method Summary
 void data(java.io.InputStream data)
          Implementation of the data receiving portion of things.
 void from(java.lang.String from)
          Called first, after the MAIL FROM during a SMTP exchange.
 void recipient(java.lang.String recipient)
          Called once for every RCPT TO during a SMTP exchange.
 void resetMessageState()
          This method is called whenever a RSET command is sent.
 
Methods inherited from class org.subethamail.smtp.server.AbstractMessageHandler
auth, getAuthenticationMechanisms, getListeners, getPrivateInputStream, resetState, setListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageHandler

public DefaultMessageHandler(MessageContext ctx,
                             AuthenticationHandler authHandler)
Method Detail

from

public void from(java.lang.String from)
          throws RejectException
Description copied from interface: MessageHandler
Called first, after the MAIL FROM during a SMTP exchange.

Parameters:
from - is the sender as specified by the client. It will be a rfc822-compliant email address, already validated by the server.
Throws:
RejectException - if the sender should be denied.

recipient

public void recipient(java.lang.String recipient)
               throws RejectException
Description copied from interface: MessageHandler
Called once for every RCPT TO during a SMTP exchange. This will occur after a from() call.

Parameters:
recipient - is a rfc822-compliant email address, validated by the server.
Throws:
RejectException - if the recipient should be denied.

resetMessageState

public void resetMessageState()
Description copied from interface: MessageHandler
This method is called whenever a RSET command is sent. It should be used to clean up any pending deliveries.


data

public void data(java.io.InputStream data)
          throws TooMuchDataException,
                 java.io.IOException
Implementation of the data receiving portion of things. By default deliver a copy of the stream to each recipient of the message(the first recipient is provided the original stream to save memory space). If you would like to change this behavior, then you should implement the MessageHandler interface yourself.

Parameters:
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