Sending email is one of popular features in a business application. Email's content and format have to test carefully before send out to customer. In the past, I often tested sending email by using Gmail's smtp, but this way would require sending some information out. In this guide, we'll explore SMTP4dev, an open-source application that simplifies email testing for developers.
Smtp4dev Instruction
smtp4dev is an open-source application that simulates an SMTP email server to test and debug emails, it lets you test your SMTP mail server. smtp4dev can run on Windows, Linux, Mac OS-X (any where .NET Core is available). you can test send mail without any real SMTP mail server.
- github: https://github.com/rnwood/smtp4dev
- BSD-3-Clause license
Smtp4dev Installation
If you don't want to use the dotnet global tool or Docker (see below if you know what those mean), you can download a standalone (or .NET Core runtime dependent) release from github.
https://github.com/rnwood/smtp4dev/releases
I will use "Windows x64 binary standalone - Desktop app edition" in this guide.
after download "Rnwood.smtp4dev.desktop-win-x64-3.7.0-ci20250120117.zip", unzip it, and run Rnwood.Smtp4dev.Desktop.exe

Smtp4dev Configuration
A program that you want to send testing mail to smtp4dev, you need to configure the host/address and port number where smtp4dev is running.
click on Icon on Right-Top, and setting as below:

Testing send mail from my application
I write a simple code to send email by c#
using System.Net;
using System.Net.Mail;
public class Program
{
public static void Main(string[] args)
{
// Replace with your actual email settings
string senderEmail = "your_email@example.com";
string senderPassword = "your_email_password";
string recipientEmail = "recipient_email@example.com";
string subject = "Test Email";
string body = "This is a test email sent from C#.";
string smtpHost = "localhost";
int smtpPort = 25;
bool enableSsl = false; // or true
try
{
using (var smtpClient = new SmtpClient(smtpHost, smtpPort))
{
smtpClient.EnableSsl = enableSsl;
smtpClient.Credentials = new NetworkCredential(senderEmail, senderPassword);
using (var mailMessage = new MailMessage(senderEmail, recipientEmail, subject, body))
{
smtpClient.Send(mailMessage);
Console.WriteLine("Email sent successfully!");
}
}
}
catch (SmtpException ex)
{
Console.WriteLine($"SMTP Error: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"Error sending email: {ex.Message}");
}
Console.ReadKey(); // Keep the console window open
}
}
when I run above code, I can see the sending email in Smtp4dev

Smtp4dev features
- OpenAPI/Swagger API
- IMAP access to retrieve and delete messages
- SMTP session logging
- UTF8 support
- Viewport size switcher to simulate mobile etc
- Multipart MIME inspector
- HTML compatibility report and HTML validation
- TLS/SSL with implicit and STARTTLS modes and auto self-signed cert generation
- Authentication
- Multiple mailboxes along with rules to control what message goes where
- Reply, compose and relay messages including rules to auto relay
- Scripting expressions including error simulation
refer: https://github.com/rnwood/smtp4dev