dumbster/0000755000175000017500000000000011614775125012606 5ustar thinkerthinkerdumbster/src/0000755000175000017500000000000010142251036013356 5ustar thinkerthinkerdumbster/src/com/0000755000175000017500000000000010142251036014134 5ustar thinkerthinkerdumbster/src/com/dumbster/0000755000175000017500000000000010142251036015761 5ustar thinkerthinkerdumbster/src/com/dumbster/smtp/0000755000175000017500000000000010220226124016741 5ustar thinkerthinkerdumbster/src/com/dumbster/smtp/SimpleSmtpServer.java0000644000175000017500000001722210220227122023073 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import java.net.ServerSocket; import java.net.Socket; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; /** * Dummy SMTP server for testing purposes. * * @todo constructor allowing user to pass preinitialized ServerSocket */ public class SimpleSmtpServer implements Runnable { /** * Stores all of the email received since this instance started up. */ private List receivedMail; /** * Default SMTP port is 25. */ public static final int DEFAULT_SMTP_PORT = 25; /** * Indicates whether this server is stopped or not. */ private volatile boolean stopped = true; /** * Handle to the server socket this server listens to. */ private ServerSocket serverSocket; /** * Port the server listens on - set to the default SMTP port initially. */ private int port = DEFAULT_SMTP_PORT; /** * Timeout listening on server socket. */ private static final int TIMEOUT = 500; /** * Constructor. * @param port port number */ public SimpleSmtpServer(int port) { receivedMail = new ArrayList(); this.port = port; } /** * Main loop of the SMTP server. */ public void run() { stopped = false; try { try { serverSocket = new ServerSocket(port); serverSocket.setSoTimeout(TIMEOUT); // Block for maximum of 1.5 seconds } finally { synchronized (this) { // Notify when server socket has been created notifyAll(); } } // Server: loop until stopped while (!isStopped()) { // Start server socket and listen for client connections Socket socket = null; try { socket = serverSocket.accept(); } catch (Exception e) { if (socket != null) { socket.close(); } continue; // Non-blocking socket timeout occurred: try accept() again } // Get the input and output streams BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream()); synchronized (this) { /* * We synchronize over the handle method and the list update because the client call completes inside * the handle method and we have to prevent the client from reading the list until we've updated it. * For higher concurrency, we could just change handle to return void and update the list inside the method * to limit the duration that we hold the lock. */ List msgs = handleTransaction(out, input); receivedMail.addAll(msgs); } socket.close(); } } catch (Exception e) { /** @todo Should throw an appropriate exception here. */ e.printStackTrace(); } finally { if (serverSocket != null) { try { serverSocket.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * Check if the server has been placed in a stopped state. Allows another thread to * stop the server safely. * @return true if the server has been sent a stop signal, false otherwise */ public synchronized boolean isStopped() { return stopped; } /** * Stops the server. Server is shutdown after processing of the current request is complete. */ public synchronized void stop() { // Mark us closed stopped = true; try { // Kick the server accept loop serverSocket.close(); } catch (IOException e) { // Ignore } } /** * Handle an SMTP transaction, i.e. all activity between initial connect and QUIT command. * * @param out output stream * @param input input stream * @return List of SmtpMessage * @throws IOException */ private List handleTransaction(PrintWriter out, BufferedReader input) throws IOException { // Initialize the state machine SmtpState smtpState = SmtpState.CONNECT; SmtpRequest smtpRequest = new SmtpRequest(SmtpActionType.CONNECT, "", smtpState); // Execute the connection request SmtpResponse smtpResponse = smtpRequest.execute(); // Send initial response sendResponse(out, smtpResponse); smtpState = smtpResponse.getNextState(); List msgList = new ArrayList(); SmtpMessage msg = new SmtpMessage(); while (smtpState != SmtpState.CONNECT) { String line = input.readLine(); if (line == null) { break; } // Create request from client input and current state SmtpRequest request = SmtpRequest.createRequest(line, smtpState); // Execute request and create response object SmtpResponse response = request.execute(); // Move to next internal state smtpState = response.getNextState(); // Send reponse to client sendResponse(out, response); // Store input in message String params = request.getParams(); msg.store(response, params); // If message reception is complete save it if (smtpState == SmtpState.QUIT) { msgList.add(msg); msg = new SmtpMessage(); } } return msgList; } /** * Send response to client. * @param out socket output stream * @param smtpResponse response object */ private static void sendResponse(PrintWriter out, SmtpResponse smtpResponse) { if (smtpResponse.getCode() > 0) { int code = smtpResponse.getCode(); String message = smtpResponse.getMessage(); out.print(code + " " + message + "\r\n"); out.flush(); } } /** * Get email received by this instance since start up. * @return List of String */ public synchronized Iterator getReceivedEmail() { return receivedMail.iterator(); } /** * Get the number of messages received. * @return size of received email list */ public synchronized int getReceivedEmailSize() { return receivedMail.size(); } /** * Creates an instance of SimpleSmtpServer and starts it. Will listen on the default port. * @return a reference to the SMTP server */ public static SimpleSmtpServer start() { return start(DEFAULT_SMTP_PORT); } /** * Creates an instance of SimpleSmtpServer and starts it. * @param port port number the server should listen to * @return a reference to the SMTP server */ public static SimpleSmtpServer start(int port) { SimpleSmtpServer server = new SimpleSmtpServer(port); Thread t = new Thread(server); t.start(); // Block until the server socket is created synchronized (server) { try { server.wait(); } catch (InterruptedException e) { // Ignore don't care. } } return server; } } dumbster/src/com/dumbster/smtp/SmtpActionType.java0000644000175000017500000001223510176500446022546 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; /** * Represents an SMTP action or command. */ public class SmtpActionType { /** Internal value for the action type. */ private byte value; /** Internal representation of the CONNECT action. */ private static final byte CONNECT_BYTE = (byte) 1; /** Internal representation of the EHLO action. */ private static final byte EHLO_BYTE = (byte) 2; /** Internal representation of the MAIL FROM action. */ private static final byte MAIL_BYTE = (byte) 3; /** Internal representation of the RCPT action. */ private static final byte RCPT_BYTE = (byte) 4; /** Internal representation of the DATA action. */ private static final byte DATA_BYTE = (byte) 5; /** Internal representation of the DATA END (.) action. */ private static final byte DATA_END_BYTE = (byte) 6; /** Internal representation of the QUIT action. */ private static final byte QUIT_BYTE = (byte) 7; /** Internal representation of an unrecognized action: body text gets this action type. */ private static final byte UNREC_BYTE = (byte) 8; /** Internal representation of the blank line action: separates headers and body text. */ private static final byte BLANK_LINE_BYTE = (byte) 9; /** Internal representation of the stateless RSET action. */ private static final byte RSET_BYTE = (byte) -1; /** Internal representation of the stateless VRFY action. */ private static final byte VRFY_BYTE = (byte) -2; /** Internal representation of the stateless EXPN action. */ private static final byte EXPN_BYTE = (byte) -3; /** Internal representation of the stateless HELP action. */ private static final byte HELP_BYTE = (byte) -4; /** Internal representation of the stateless NOOP action. */ private static final byte NOOP_BYTE = (byte) -5; /** CONNECT action. */ public static final SmtpActionType CONNECT = new SmtpActionType(CONNECT_BYTE); /** EHLO action. */ public static final SmtpActionType EHLO = new SmtpActionType(EHLO_BYTE); /** MAIL action. */ public static final SmtpActionType MAIL = new SmtpActionType(MAIL_BYTE); /** RCPT action. */ public static final SmtpActionType RCPT = new SmtpActionType(RCPT_BYTE); /** DATA action. */ public static final SmtpActionType DATA = new SmtpActionType(DATA_BYTE); /** "." action. */ public static final SmtpActionType DATA_END = new SmtpActionType(DATA_END_BYTE); /** Body text action. */ public static final SmtpActionType UNRECOG = new SmtpActionType(UNREC_BYTE); /** QUIT action. */ public static final SmtpActionType QUIT = new SmtpActionType(QUIT_BYTE); /** Header/body separator action. */ public static final SmtpActionType BLANK_LINE = new SmtpActionType(BLANK_LINE_BYTE); /** Stateless RSET action. */ public static final SmtpActionType RSET = new SmtpActionType(RSET_BYTE); /** Stateless VRFY action. */ public static final SmtpActionType VRFY = new SmtpActionType(VRFY_BYTE); /** Stateless EXPN action. */ public static final SmtpActionType EXPN = new SmtpActionType(EXPN_BYTE); /** Stateless HELP action. */ public static final SmtpActionType HELP = new SmtpActionType(HELP_BYTE); /** Stateless NOOP action. */ public static final SmtpActionType NOOP = new SmtpActionType(NOOP_BYTE); /** * Create a new SMTP action type. Private to ensure no invalid values. * @param value one of the _BYTE values */ private SmtpActionType(byte value) { this.value = value; } /** * Indicates whether the action is stateless or not. * @return true iff the action is stateless */ public boolean isStateless() { return value < 0; } /** * String representation of this SMTP action type. * @return a String */ public String toString() { switch(value) { case CONNECT_BYTE: return "Connect"; case EHLO_BYTE: return "EHLO"; case MAIL_BYTE: return "MAIL"; case RCPT_BYTE: return "RCPT"; case DATA_BYTE: return "DATA"; case DATA_END_BYTE: return "."; case QUIT_BYTE: return "QUIT"; case RSET_BYTE: return "RSET"; case VRFY_BYTE: return "VRFY"; case EXPN_BYTE: return "EXPN"; case HELP_BYTE: return "HELP"; case NOOP_BYTE: return "NOOP"; case UNREC_BYTE: return "Unrecognized command / data"; case BLANK_LINE_BYTE: return "Blank line"; default: return "Unknown"; } } } dumbster/src/com/dumbster/smtp/SmtpMessage.java0000644000175000017500000001015310176501060022041 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.util.Set; /** * Container for a complete SMTP message - headers and message body. */ public class SmtpMessage { /** Headers: Map of List of String hashed on header name. */ private Map headers; /** Message body. */ private StringBuffer body; /** * Constructor. Initializes headers Map and body buffer. */ public SmtpMessage() { headers = new HashMap(10); body = new StringBuffer(); } /** * Update the headers or body depending on the SmtpResponse object and line of input. * @param response SmtpResponse object * @param params remainder of input line after SMTP command has been removed */ public void store(SmtpResponse response, String params) { if (params != null) { if (SmtpState.DATA_HDR.equals(response.getNextState())) { int headerNameEnd = params.indexOf(':'); if (headerNameEnd >= 0) { String name = params.substring(0, headerNameEnd).trim(); String value = params.substring(headerNameEnd+1).trim(); addHeader(name, value); } } else if (SmtpState.DATA_BODY == response.getNextState()) { body.append(params); } } } /** * Get an Iterator over the header names. * @return an Iterator over the set of header names (String) */ public Iterator getHeaderNames() { Set nameSet = headers.keySet(); return nameSet.iterator(); } /** * Get the value(s) associated with the given header name. * @param name header name * @return value(s) associated with the header name */ public String[] getHeaderValues(String name) { List values = (List)headers.get(name); if (values == null) { return new String[0]; } else { return (String[])values.toArray(new String[0]); } } /** * Get the first values associated with a given header name. * @param name header name * @return first value associated with the header name */ public String getHeaderValue(String name) { List values = (List)headers.get(name); if (values == null) { return null; } else { Iterator iterator = values.iterator(); return (String)iterator.next(); } } /** * Get the message body. * @return message body */ public String getBody() { return body.toString(); } /** * Adds a header to the Map. * @param name header name * @param value header value */ private void addHeader(String name, String value) { List valueList = (List)headers.get(name); if (valueList == null) { valueList = new ArrayList(1); headers.put(name, valueList); } valueList.add(value); } /** * String representation of the SmtpMessage. * @return a String */ public String toString() { StringBuffer msg = new StringBuffer(); for(Iterator i = headers.keySet().iterator(); i.hasNext();) { String name = (String)i.next(); List values = (List)headers.get(name); for(Iterator j = values.iterator(); j.hasNext();) { String value = (String)j.next(); msg.append(name); msg.append(": "); msg.append(value); msg.append('\n'); } } msg.append('\n'); msg.append(body); msg.append('\n'); return msg.toString(); } } dumbster/src/com/dumbster/smtp/SmtpRequest.java0000644000175000017500000002330210146233704022111 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; /** * Contains an SMTP client request. Handles state transitions using the following state transition table. *
 * -----------+-------------------------------------------------------------------------------------------------
 *            |                                 State
 *  Action    +-------------+-----------+-----------+--------------+---------------+---------------+------------
 *            | CONNECT     | GREET     | MAIL      | RCPT         | DATA_HDR      | DATA_BODY     | QUIT
 * -----------+-------------+-----------+-----------+--------------+---------------+---------------+------------
 * connect    | 220/GREET   | 503/GREET | 503/MAIL  | 503/RCPT     | 503/DATA_HDR  | 503/DATA_BODY | 503/QUIT
 * ehlo       | 503/CONNECT | 250/MAIL  | 503/MAIL  | 503/RCPT     | 503/DATA_HDR  | 503/DATA_BODY | 503/QUIT
 * mail       | 503/CONNECT | 503/GREET | 250/RCPT  | 503/RCPT     | 503/DATA_HDR  | 503/DATA_BODY | 250/RCPT
 * rcpt       | 503/CONNECT | 503/GREET | 503/MAIL  | 250/RCPT     | 503/DATA_HDR  | 503/DATA_BODY | 503/QUIT
 * data       | 503/CONNECT | 503/GREET | 503/MAIL  | 354/DATA_HDR | 503/DATA_HDR  | 503/DATA_BODY | 503/QUIT
 * data_end   | 503/CONNECT | 503/GREET | 503/MAIL  | 503/RCPT     | 250/QUIT      | 250/QUIT      | 503/QUIT
 * unrecog    | 500/CONNECT | 500/GREET | 500/MAIL  | 500/RCPT     | ---/DATA_HDR  | ---/DATA_BODY | 500/QUIT
 * quit       | 503/CONNECT | 503/GREET | 503/MAIL  | 503/RCPT     | 503/DATA_HDR  | 503/DATA_BODY | 250/CONNECT
 * blank_line | 503/CONNECT | 503/GREET | 503/MAIL  | 503/RCPT     | ---/DATA_BODY | ---/DATA_BODY | 503/QUIT
 * rset       | 250/GREET   | 250/GREET | 250/GREET | 250/GREET    | 250/GREET     | 250/GREET     | 250/GREET
 * vrfy       | 252/CONNECT | 252/GREET | 252/MAIL  | 252/RCPT     | 252/DATA_HDR  | 252/DATA_BODY | 252/QUIT
 * expn       | 252/CONNECT | 252/GREET | 252/MAIL  | 252/RCPT     | 252/DATA_HDR  | 252/DATA_BODY | 252/QUIT
 * help       | 211/CONNECT | 211/GREET | 211/MAIL  | 211/RCPT     | 211/DATA_HDR  | 211/DATA_BODY | 211/QUIT
 * noop       | 250/CONNECT | 250/GREET | 250/MAIL  | 250/RCPT     | 250|DATA_HDR  | 250/DATA_BODY | 250/QUIT
 * 
*/ public class SmtpRequest { /** SMTP action received from client. */ private SmtpActionType action; /** Current state of the SMTP state table. */ private SmtpState state; /** Additional information passed from the client with the SMTP action. */ private String params; /** * Create a new SMTP client request. * @param actionType type of action/command * @param params remainder of command line once command is removed * @param state current SMTP server state */ public SmtpRequest(SmtpActionType actionType, String params, SmtpState state) { this.action = actionType; this.state = state; this.params = params; } /** * Execute the SMTP request returning a response. This method models the state transition table for the SMTP server. * @return reponse to the request */ public SmtpResponse execute() { SmtpResponse response = null; if (action.isStateless()) { if (SmtpActionType.EXPN == action || SmtpActionType.VRFY == action) { response = new SmtpResponse(252, "Not supported", this.state); } else if (SmtpActionType.HELP == action) { response = new SmtpResponse(211, "No help available", this.state); } else if (SmtpActionType.NOOP == action) { response = new SmtpResponse(250, "OK", this.state); } else if (SmtpActionType.VRFY == action) { response = new SmtpResponse(252, "Not supported", this.state); } else if (SmtpActionType.RSET == action) { response = new SmtpResponse(250, "OK", SmtpState.GREET); } else { response = new SmtpResponse(500, "Command not recognized", this.state); } } else { // Stateful commands if (SmtpActionType.CONNECT == action) { if (SmtpState.CONNECT == state) { response = new SmtpResponse(220, "localhost Dumbster SMTP service ready", SmtpState.GREET); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.EHLO == action) { if (SmtpState.GREET == state) { response = new SmtpResponse(250, "OK", SmtpState.MAIL); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.MAIL == action) { if (SmtpState.MAIL == state || SmtpState.QUIT == state) { response = new SmtpResponse(250, "OK", SmtpState.RCPT); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.RCPT == action) { if (SmtpState.RCPT == state) { response = new SmtpResponse(250, "OK", this.state); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.DATA == action) { if (SmtpState.RCPT == state) { response = new SmtpResponse(354, "Start mail input; end with .", SmtpState.DATA_HDR); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.UNRECOG == action) { if (SmtpState.DATA_HDR == state || SmtpState.DATA_BODY == state) { response = new SmtpResponse(-1, "", this.state); } else { response = new SmtpResponse(500, "Command not recognized", this.state); } } else if (SmtpActionType.DATA_END == action) { if (SmtpState.DATA_HDR == state || SmtpState.DATA_BODY == state) { response = new SmtpResponse(250, "OK", SmtpState.QUIT); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.BLANK_LINE == action) { if (SmtpState.DATA_HDR == state) { response = new SmtpResponse(-1, "", SmtpState.DATA_BODY); } else if (SmtpState.DATA_BODY == state) { response = new SmtpResponse(-1, "", this.state); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else if (SmtpActionType.QUIT == action) { if (SmtpState.QUIT == state) { response = new SmtpResponse(221, "localhost Dumbster service closing transmission channel", SmtpState.CONNECT); } else { response = new SmtpResponse(503, "Bad sequence of commands: "+action, this.state); } } else { response = new SmtpResponse(500, "Command not recognized", this.state); } } return response; } /** * Create an SMTP request object given a line of the input stream from the client and the current internal state. * @param s line of input * @param state current state * @return a populated SmtpRequest object */ public static SmtpRequest createRequest(String s, SmtpState state) { SmtpActionType action = null; String params = null; if (state == SmtpState.DATA_HDR) { if (s.equals(".")) { action = SmtpActionType.DATA_END; } else if (s.length() < 1) { action = SmtpActionType.BLANK_LINE; } else { action = SmtpActionType.UNRECOG; params = s; } } else if (state == SmtpState.DATA_BODY) { if (s.equals(".")) { action = SmtpActionType.DATA_END; } else { action = SmtpActionType.UNRECOG; if (s.length() < 1) { params = "\n"; } else { params = s; } } } else { String su = s.toUpperCase(); if (su.startsWith("EHLO ") || su.startsWith("HELO")) { action = SmtpActionType.EHLO; params = s.substring(5); } else if (su.startsWith("MAIL FROM:")) { action = SmtpActionType.MAIL; params = s.substring(10); } else if (su.startsWith("RCPT TO:")) { action = SmtpActionType.RCPT; params = s.substring(8); } else if (su.startsWith("DATA")) { action = SmtpActionType.DATA; } else if (su.startsWith("QUIT")) { action = SmtpActionType.QUIT; } else if (su.startsWith("RSET")) { action = SmtpActionType.RSET; } else if (su.startsWith("NOOP")) { action = SmtpActionType.NOOP; } else if (su.startsWith("EXPN")) { action = SmtpActionType.EXPN; } else if (su.startsWith("VRFY")) { action = SmtpActionType.VRFY; } else if (su.startsWith("HELP")) { action = SmtpActionType.HELP; } else { action = SmtpActionType.UNRECOG; } } SmtpRequest req = new SmtpRequest(action, params, state); return req; } /** * Get the parameters of this request (remainder of command line once the command is removed. * @return parameters */ public String getParams() { return params; } } dumbster/src/com/dumbster/smtp/SmtpResponse.java0000644000175000017500000000321410146233664022264 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; /** * SMTP response container. */ public class SmtpResponse { /** Response code - see RFC-2821. */ private int code; /** Response message. */ private String message; /** New state of the SMTP server once the request has been executed. */ private SmtpState nextState; /** * Constructor. * @param code response code * @param message response message * @param next next state of the SMTP server */ public SmtpResponse(int code, String message, SmtpState next) { this.code = code; this.message = message; this.nextState = next; } /** * Get the response code. * @return response code */ public int getCode() { return code; } /** * Get the response message. * @return response message */ public String getMessage() { return message; } /** * Get the next SMTP server state. * @return state */ public SmtpState getNextState() { return nextState; } } dumbster/src/com/dumbster/smtp/SmtpState.java0000644000175000017500000000624510176501060021544 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; /** * SMTP server state. */ public class SmtpState { /** Internal representation of the state. */ private byte value; /** Internal representation of the CONNECT state. */ private static final byte CONNECT_BYTE = (byte) 1; /** Internal representation of the GREET state. */ private static final byte GREET_BYTE = (byte) 2; /** Internal representation of the MAIL state. */ private static final byte MAIL_BYTE = (byte) 3; /** Internal representation of the RCPT state. */ private static final byte RCPT_BYTE = (byte) 4; /** Internal representation of the DATA_HEADER state. */ private static final byte DATA_HEADER_BYTE = (byte) 5; /** Internal representation of the DATA_BODY state. */ private static final byte DATA_BODY_BYTE = (byte) 6; /** Internal representation of the QUIT state. */ private static final byte QUIT_BYTE = (byte) 7; /** CONNECT state: waiting for a client connection. */ public static final SmtpState CONNECT = new SmtpState(CONNECT_BYTE); /** GREET state: wating for a ELHO message. */ public static final SmtpState GREET = new SmtpState(GREET_BYTE); /** MAIL state: waiting for the MAIL FROM: command. */ public static final SmtpState MAIL = new SmtpState(MAIL_BYTE); /** RCPT state: waiting for a RCPT <email address> command. */ public static final SmtpState RCPT = new SmtpState(RCPT_BYTE); /** Waiting for headers. */ public static final SmtpState DATA_HDR = new SmtpState(DATA_HEADER_BYTE); /** Processing body text. */ public static final SmtpState DATA_BODY = new SmtpState(DATA_BODY_BYTE); /** End of client transmission. */ public static final SmtpState QUIT = new SmtpState(QUIT_BYTE); /** * Create a new SmtpState object. Private to ensure that only valid states can be created. * @param value one of the _BYTE values. */ private SmtpState(byte value) { this.value = value; } /** * String representation of this SmtpState. * @return a String */ public String toString() { switch(value) { case CONNECT_BYTE: return "CONNECT"; case GREET_BYTE: return "GREET"; case MAIL_BYTE: return "MAIL"; case RCPT_BYTE: return "RCPT"; case DATA_HEADER_BYTE: return "DATA_HDR"; case DATA_BODY_BYTE: return "DATA_BODY"; case QUIT_BYTE: return "QUIT"; default: return "Unknown"; } } } dumbster/test-src/0000755000175000017500000000000010142251036014333 5ustar thinkerthinkerdumbster/test-src/com/0000755000175000017500000000000010142251036015111 5ustar thinkerthinkerdumbster/test-src/com/dumbster/0000755000175000017500000000000010142251036016736 5ustar thinkerthinkerdumbster/test-src/com/dumbster/smtp/0000755000175000017500000000000010220224410017712 5ustar thinkerthinkerdumbster/test-src/com/dumbster/smtp/AllTests.java0000644000175000017500000000206510220224526022323 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import junit.framework.*; public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTestSuite(SimpleSmtpServerTest.class); suite.addTestSuite(SmtpRequestTest.class); suite.addTestSuite(BindProblemTest.class); return suite; } public static void main(String args[]) { junit.textui.TestRunner.run(suite()); } } dumbster/test-src/com/dumbster/smtp/BindProblemTest.java0000644000175000017500000000264210220226370023625 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import junit.framework.TestCase; /** * @author JeremyH */ public class BindProblemTest extends TestCase { private SimpleSmtpServer server; /** * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); server = SimpleSmtpServer.start(); } /** * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { server.stop(); super.tearDown(); } public void test1() { assertTrue(true); } public void test2() { assertTrue(true); } public void test3() { assertTrue(true); } public void test4() { assertTrue(true); } public void test5() { assertTrue(true); } } dumbster/test-src/com/dumbster/smtp/SimpleSmtpServerTest.java0000644000175000017500000001456110200257176024725 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import junit.framework.TestCase; import javax.mail.Session; import javax.mail.Message; import javax.mail.Transport; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import javax.mail.internet.InternetAddress; import java.util.Properties; import java.util.Date; import java.util.Iterator; public class SimpleSmtpServerTest extends TestCase { private static final int SMTP_PORT = 1081; SimpleSmtpServer server; public SimpleSmtpServerTest(String s) { super(s); } protected void setUp() throws Exception { super.setUp(); server = SimpleSmtpServer.start(SMTP_PORT); } protected void tearDown() throws Exception { super.tearDown(); server.stop(); } public void testSend() { try { sendMessage(SMTP_PORT, "sender@here.com", "Test", "Test Body", "receiver@there.com"); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception: " + e); } assertTrue(server.getReceivedEmailSize() == 1); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); assertTrue(email.getHeaderValue("Subject").equals("Test")); assertTrue(email.getBody().equals("Test Body")); } public void testSendMessageWithCarriageReturn() { String bodyWithCR = "\n\nKeep these pesky carriage returns\n\n"; try { sendMessage(SMTP_PORT, "sender@hereagain.com", "CRTest", bodyWithCR, "receivingagain@there.com"); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception: " + e); } assertTrue(server.getReceivedEmailSize() == 1); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); assertTrue(email.getBody().equals(bodyWithCR)); } public void testSendTwoMessagesSameConnection() { try { MimeMessage[] mimeMessages = new MimeMessage[2]; Properties mailProps = getMailProperties(SMTP_PORT); Session session = Session.getInstance(mailProps, null); //session.setDebug(true); mimeMessages[0] = createMessage(session, "sender@whatever.com", "receiver@home.com", "Doodle1", "Bug1"); mimeMessages[1] = createMessage(session, "sender@whatever.com", "receiver@home.com", "Doodle2", "Bug2"); Transport transport = session.getTransport("smtp"); transport.connect("localhost", SMTP_PORT, null, null); for (int i = 0; i < mimeMessages.length; i++) { MimeMessage mimeMessage = mimeMessages[i]; transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients()); } transport.close(); } catch (MessagingException e) { e.printStackTrace(); fail("Unexpected exception: " + e); } assertTrue(server.getReceivedEmailSize() == 2); } public void testSendTwoMsgsWithLogin() { try { String Server = "localhost"; String From = "sender@here.com"; String To = "receiver@there.com"; String Subject = "Test"; String body = "Test Body"; Properties props = System.getProperties(); if (Server != null) { props.put("mail.smtp.host", Server); } Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); if (From != null) { msg.setFrom(new InternetAddress(From)); } else { msg.setFrom(); } InternetAddress.parse(To, false); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(To, false)); msg.setSubject(Subject); msg.setText(body); msg.setHeader("X-Mailer", "musala"); msg.setSentDate(new Date()); msg.saveChanges(); Transport transport = null; try { transport = session.getTransport("smtp"); transport.connect(Server, SMTP_PORT, "ddd", "ddd"); transport.sendMessage(msg, InternetAddress.parse(To, false)); transport.sendMessage(msg, InternetAddress.parse("dimiter.bakardjiev@musala.com", false)); } catch (javax.mail.MessagingException me) { me.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { if (transport != null) { transport.close(); } } } catch (Exception e) { e.printStackTrace(); } assertTrue(server.getReceivedEmailSize() == 2); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); assertTrue(email.getHeaderValue("Subject").equals("Test")); assertTrue(email.getBody().equals("Test Body")); } private Properties getMailProperties(int port) { Properties mailProps = new Properties(); mailProps.setProperty("mail.smtp.host", "localhost"); mailProps.setProperty("mail.smtp.port", "" + port); mailProps.setProperty("mail.smtp.sendpartial", "true"); return mailProps; } private void sendMessage(int port, String from, String subject, String body, String to) throws MessagingException { Properties mailProps = getMailProperties(port); Session session = Session.getInstance(mailProps, null); //session.setDebug(true); MimeMessage msg = createMessage(session, from, to, subject, body); Transport.send(msg); } private MimeMessage createMessage( Session session, String from, String to, String subject, String body) throws MessagingException { MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(body); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); return msg; } } dumbster/test-src/com/dumbster/smtp/SmtpRequestTest.java0000644000175000017500000000466210146233544023740 0ustar thinkerthinker/* * Dumbster - a dummy SMTP server * Copyright 2004 Jason Paul Kitchen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dumbster.smtp; import junit.framework.TestCase; public class SmtpRequestTest extends TestCase { public void testUnrecognizedCommandConnectState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.CONNECT); SmtpResponse response = request.execute(); assertTrue(response.getCode() == 500); } public void testUnrecognizedCommandGreetState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.GREET); SmtpResponse response = request.execute(); assertTrue(response.getCode() == 500); } public void testUnrecognizedCommandMailState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.MAIL); SmtpResponse response = request.execute(); assertTrue(response.getCode() == 500); } public void testUnrecognizedCommandQuitState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.QUIT); SmtpResponse response = request.execute(); assertTrue(response.getCode() == 500); } public void testUnrecognizedCommandRcptState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.RCPT); SmtpResponse response = request.execute(); assertTrue(response.getCode() == 500); } public void testUnrecognizedCommandDataBodyState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.DATA_BODY); SmtpResponse response = request.execute(); assertTrue(response.getCode() == -1); } public void testUnrecognizedCommandDataHdrState() { SmtpRequest request = new SmtpRequest(SmtpActionType.UNRECOG, null, SmtpState.DATA_HDR); SmtpResponse response = request.execute(); assertTrue(response.getCode() == -1); } } dumbster/build.xml0000644000175000017500000001002010224263120014377 0ustar thinkerthinker dumbster/license.txt0000644000175000017500000002644610146233132014767 0ustar thinkerthinker Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. dumbster/notice.txt0000644000175000017500000000000010146234126014604 0ustar thinkerthinkerdumbster/TEST-com.dumbster.smtp.AllTests.txt0000644000175000017500000000152210224265416021233 0ustar thinkerthinkerTestsuite: com.dumbster.smtp.AllTests Tests run: 16, Failures: 0, Errors: 0, Time elapsed: 0.821 sec Testcase: testSend took 0.701 sec Testcase: testSendMessageWithCarriageReturn took 0.02 sec Testcase: testSendTwoMessagesSameConnection took 0.03 sec Testcase: testSendTwoMsgsWithLogin took 0.02 sec Testcase: testUnrecognizedCommandConnectState took 0.01 sec Testcase: testUnrecognizedCommandGreetState took 0 sec Testcase: testUnrecognizedCommandMailState took 0 sec Testcase: testUnrecognizedCommandQuitState took 0 sec Testcase: testUnrecognizedCommandRcptState took 0 sec Testcase: testUnrecognizedCommandDataBodyState took 0 sec Testcase: testUnrecognizedCommandDataHdrState took 0 sec Testcase: test1 took 0.01 sec Testcase: test2 took 0 sec Testcase: test3 took 0 sec Testcase: test4 took 0 sec Testcase: test5 took 0 sec dumbster/version.txt0000644000175000017500000000470610224263166015034 0ustar thinkerthinkerThe following is a list of changes per release: 1.6 (2005-04-04) Fixed threading and synchronization problems (sourceforge tracker id: 1111796). Thanks to Charles Hudak for pointing out these issues. Build now fails on unit test failure (sourceforge tracker id: 1115202). Thanks to Charles Hudak for complaining about this. Fixed a few more threading issues related to the time required for the server socket to bind. Thanks to Jeremy Hulford for researching and providing a fix for this issue. 1.5 (2004-11-18) Moved from LGPL license to Apache License Version 2.0. See http://www.apache.org/licenses/LICENSE-2.0.txt. This provides at least the same freedoms as the LGPL license but does not have the potential legal problems associated with imports from other libraries. Removed vestiges of port 25 from unit tests to allow OSX and *nix to run on non-priveleged ports. 1.4 (2004-11-2) Fixed bug where misbehaving SMTP clients cause Dumbster to fail with a NullPointerException (sourceforge tracker id: 1055322). Binary distribution (jar with class files) now available in addition to source (sourceforge tracker id: 1059102). Corrected mispelling of SimpleSmtpServer.getReceivedEmailSize() again (can't believe how long I stared at this until I saw it - thanks to Ken Pelletier). Stopped using port 25 and 80 in unit tests - these are priveleged ports under *nix and OSX (thanks to Ken Pelletier and Mark Lowe). Uncommented stack trace on server startup failure (this probably ought to throw an IllegalStateException or something, but at least this way any failure won't be hidden) - thanks Ken Pelletier. CVS now operational for the Dumbster project. Added javadoc target to "build.xml". 1.3 (2004-10-08) Documented internal state transition table (see Javadoc for SmtpRequest). Fixed bug which prevented mutliple messages in the same connection from being transferred (sourceforge tracker id: 1022357). 1.2 (2004-05-08) Configurable SMTP port (thanks Dr. Christian Möller and Kevin Fries). Mispelled getReceievedEmailSize (Sourceforge tracker id: 824194). Not able to enter '\n' in body of message (sourceforge tracker id: 903326). 1.1 (2003-09-28) Change from GPL license to LGPL license. HELO command is now recognized (not just EHLO). 1.0 (2003-06-08) Initial version released in conjunction with the JavaWorld article "Test email components in your software". See: http://www.javaworld.com/javaworld/jw-08-2003/jw-0829-smtp.html