Top Related Projects
Web and API based SMTP testing
:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.
Catches mail and serves it through a dream.
Quick Overview
FakeSMTP is a lightweight, cross-platform fake SMTP server designed for testing email functionality in applications. It provides a simple way to catch and view emails sent by your application without actually sending them to real recipients, making it an invaluable tool for developers during the testing and debugging process.
Pros
- Easy to set up and use, with a user-friendly graphical interface
- Cross-platform compatibility (Windows, macOS, Linux)
- Supports saving received emails as .eml files for later analysis
- Customizable port and other settings to fit various testing scenarios
Cons
- Limited advanced features compared to more comprehensive email testing solutions
- Not suitable for production use or as a real SMTP server
- May require additional configuration in complex network environments
- Lacks built-in email content analysis tools
Getting Started
- Download the latest JAR file from the releases page.
- Run the JAR file using Java:
java -jar fakesmtp-2.0.jar
- Configure your application to use
localhost
as the SMTP server and the port you specified in FakeSMTP (default is 25). - Send emails from your application and view them in the FakeSMTP interface.
For more advanced usage, you can start FakeSMTP with command-line arguments:
java -jar fakesmtp-2.0.jar -s -b -p 2525 -a 192.168.1.10 -o /path/to/emails
This command starts FakeSMTP in background mode (-b), on port 2525 (-p), bound to IP 192.168.1.10 (-a), saving emails to the specified directory (-o), and starts the SMTP server automatically (-s).
Competitor Comparisons
Web and API based SMTP testing
Pros of MailHog
- More feature-rich with a web UI, API, and support for multiple storage backends
- Cross-platform compatibility (Windows, macOS, Linux)
- Active development and community support
Cons of MailHog
- More complex setup compared to FakeSMTP
- Requires Go runtime environment
- Larger resource footprint
Code Comparison
MailHog (Go):
func CreateMail(from string, to []string, subject string, body string) (*data.Message, error) {
msg := &data.Message{
From: from,
To: to,
Subject: subject,
Body: body,
}
return msg, nil
}
FakeSMTP (Java):
public void createMail(String from, String[] to, String subject, String body) {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
for (String recipient : to) {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));
}
message.setSubject(subject);
message.setText(body);
}
Both projects serve as fake SMTP servers for testing email functionality in applications. MailHog offers a more comprehensive solution with its web interface and API, making it suitable for larger projects and teams. FakeSMTP, on the other hand, provides a simpler, lightweight option that may be preferable for smaller projects or quick testing scenarios. The choice between the two depends on the specific requirements of the project and the development environment.
:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.
Pros of maildev
- Web-based interface for viewing and testing emails
- Supports both SMTP and API-based email sending
- More actively maintained with recent updates
Cons of maildev
- Requires Node.js runtime
- More complex setup compared to FakeSMTP
- Larger codebase and dependencies
Code comparison
FakeSMTP (Java):
public void start() {
if (!running) {
running = true;
Thread smtpServerThread = new Thread(new Runnable() {
@Override
public void run() {
startServer();
}
});
smtpServerThread.start();
}
}
maildev (JavaScript):
async start() {
if (this.port) {
await this.smtp.listen(this.port, this.host)
logger.info(`MailDev SMTP Server running at ${this.host}:${this.port}`)
}
if (this.webPort) {
await this.web.listen(this.webPort, this.host)
logger.info(`MailDev webapp running at ${this.host}:${this.webPort}`)
}
}
Both projects serve as fake SMTP servers for testing email functionality in applications. FakeSMTP is a simpler, Java-based solution, while maildev offers a more feature-rich experience with a web interface and additional capabilities. The choice between them depends on specific project requirements and the preferred development environment.
Catches mail and serves it through a dream.
Pros of Mailcatcher
- Web-based interface for viewing captured emails
- Supports multiple email formats (HTML, plain text)
- Easy integration with various development environments
Cons of Mailcatcher
- Requires Ruby installation and dependencies
- May have performance issues with large volumes of emails
Code Comparison
FakeSMTP (Java):
public static void main(String[] args) {
SMTPServer smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(new ConsoleMessageHandler()));
smtpServer.setPort(2525);
smtpServer.start();
}
Mailcatcher (Ruby):
require 'mailcatcher'
MailCatcher.run! do
serve_messages
serve_web
end
Key Differences
- FakeSMTP is written in Java, while Mailcatcher is written in Ruby
- FakeSMTP focuses on simplicity and lightweight operation, while Mailcatcher offers more features through its web interface
- FakeSMTP stores emails as .eml files, whereas Mailcatcher keeps them in memory
- Mailcatcher provides a more user-friendly interface for viewing and managing captured emails
- FakeSMTP may be easier to set up in Java-based environments, while Mailcatcher is more suitable for Ruby-centric development stacks
Both tools serve the purpose of capturing and inspecting emails during development, but they cater to different language ecosystems and offer varying levels of functionality.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
FakeSMTP
FakeSMTP is a Free Fake SMTP Server with GUI for testing emails in applications easily. It is written in Java.

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 1.6 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:
java -jar fakeSMTP-VERSION.jar
If you want to specify the directory where emails will be saved when starting the application, you can use the -o
argument:
java -jar fakeSMTP-VERSION.jar -o output_directory_name
java -jar fakeSMTP-VERSION.jar --output-dir output_directory_name
If you want to autostart the SMTP server at launch, you can use the -s
argument:
java -jar fakeSMTP-VERSION.jar -s
java -jar fakeSMTP-VERSION.jar --start-server
If you want to autostart the SMTP server without a GUI (background) on a different port and bound to the loopback address:
java -jar fakeSMTP-VERSION.jar -s -b -p 2525 -a 127.0.0.1
java -jar fakeSMTP-VERSION.jar --start-server --background --port 2525 --bind-address 127.0.0.1
If you don't need to save emails on the filesystem (to improve the overall performances), you can use the -m
(memory mode) argument:
java -jar fakeSMTP-VERSION.jar -m
To see all the available options (relay domains, custom eml-viewer...):
java -jar fakeSMTP-VERSION.jar --help
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:
- Nice features;
- Open source;
- Windows only (written in .Net).
- Lightweight;
- Closed source;
- Cross-Platform (written in Java 1.4).
Building it
You need to download and setup Maven. Once installed, go to project directory and run the following command:
mvn package -Dmaven.test.skip
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
.
java -jar fakeSMTP-VERSION.jar -p 2525 -s
You can then run the following command:
mvn integration-test
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
-
Run distributed version: Dockerfile
`docker build -t="mail" github.com/Nilhcem/FakeSMTP` `docker run -ti -p 250:25 --privileged=true -v /mail:/output mail`
-
Build from source
Get sources from GitHub: Dockerfile
git clone https://github.com/Nilhcem/FakeSMTP
cd FakeSMTP
Build the docker image
mvn package docker:build -DskipTests
Run the docker image
docker run -ti -d fakesmtp
Configure container
-
Map the SMTP port 25 to host:
-p 250:25
-
Map volume for received mails:
--privileged=true -v /mail-data:/output
Full command
-
Foward fakesmtp:25 to host port 250,
-
mount host folder /home/fakesmtp/mail as container folder /output
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
Top Related Projects
Web and API based SMTP testing
:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.
Catches mail and serves it through a dream.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot