/ DEVELOPMENT,Java,Tools Java: Fake SMTP Server for your development

Java: Fake SMTP Server for your development


Today, I propose a very simple fake SMTP server designed for unit and system testing applications that send email messages. The class is a ServerSocket (Runnable) which responds to the standard SMTP commands but does not deliver messages to the user. The messages are printed in the full SMTP server log containing all the information exchanged between the SMTP server & the clients.

This ServerSocket could be executed in standalone in a Runnable or in a WEB project via a ContextServletListener configured in the web.xml:

	public static void main(String[] args) {
		try {
			FakeSMTPServer srv = new FakeSMTPServer();
			while (true) {
			} // end-while
		} catch (Exception e) {
		} // end-try

The classes in attachment need the junit-4.1.jar, mail-1.3.2.jar and spring-2.5.5.jar to be used.

Note: There is other products like SMTP4DEV usable directly without installation.

1 thought on “Java: Fake SMTP Server for your development”

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post