= FakeSMTP
[link=https://github.com/ghusta/FakeSMTP/actions/workflows/maven-build.yml] image::https://github.com/ghusta/FakeSMTP/actions/workflows/maven-build.yml/badge.svg[] [link=https://github.com/ghusta/FakeSMTP/releases/latest] image::https://img.shields.io/github/v/release/ghusta/FakeSMTP.svg?logo=github[]
FakeSMTP is a Free Fake SMTP Server with GUI for testing emails in applications easily. It is written in Java.
image:doc/capture1.png[]
Configure your application to use localhost
as your SMTP server, and all
emails will be intercepted and displayed in this software.
FakeSMTP uses SubEthaSMTP: an easy-to-use server-side SMTP library for Java.
FakeSMTP is free to use for commercial and non-commercial projects and the source code is provided.
It is licensed under the very free BSD or GPL license, whichever you prefer.
== Requirements
You need Java JVM 8 or newer installed on your machine.
If you are on a "Unix-like" machine (Mac, GNU/Linux, BSD…), you may have
to be "root" to start the port 25
, otherwise, try another port >= 1024
.
== Usage
The fakeSMTP.jar is auto-executable. If your desktop environment supports it, you can directly double-click on the .jar file. Otherwise, run the following command:
If you want to specify the directory where emails will be saved when starting the application, you can use the -o
argument:
If you want to autostart the SMTP server at launch, you can use the -s
argument:
If you want to autostart the SMTP server without a GUI (background) on a different port and bound to the loopback address:
If you don't need to save emails on the filesystem (to improve the overall performances), you can use the -m
(memory mode) argument:
To see all the available options (relay domains, custom eml-viewer…):
== Alternatives
FakeSMTP was created because we couldn't find any free (as in freedom) and cross-platform SMTP server with GUI for testing emails in applications or websites. Listed below are some greats alternatives to Fake SMTP:
http://smtp4dev.codeplex.com/[SMTP4dev]
http://www.aboutmyip.com/AboutMyXApp/DevNullSmtp.jsp[DevNull SMTP]
== Building it
You need to download and setup Maven. Once installed, go to project directory and run the following command:
This command will create an executable jar on the target folder.
We recommend you not to skip unit tests.
Once you know how to configure unit tests for this project, stop skipping them.
== Running integration tests
To run integration tests, you will first need to launch the application
and start the server on port 2525
.
You can then run the following command:
== Change the default port for unit/integration tests
You need to modify the following file:
src/test/java/com/nilhcem/fakesmtp/core/test/TestConfig.java
.
Please note that it is better to have two different ports for unit and integrations tests, to avoid any port binding exception while running Maven's integration-test
goal.
== Usage on Docker
docker build -t="mail" github.com/Nilhcem/FakeSMTP
Get sources from GitHub: https://github.com/Nilhcem/FakeSMTP/blob/master/src/main/docker/Dockerfile[Dockerfile]
Build the docker image
Run the docker image
Configure container
-p 250:25
--privileged=true -v /mail-data:/output
Full command
docker run -ti -d -p 250:25 --privileged=true -v /home/fakesmtp/mail:/output fakesmtp
== Contact me
Use my github's nickname (at) gmail (dot) com