nDumbster is a simple fake SMTP based on the original Dumbster java sourcecode. It has been ported to C# to enable .Net developper to unit test applications that send email messages.
nDumbster support all standard SMTP commands but instead of delivering messages to the user, it stores then in memory so they can be tested later.
Compared to other testing strategies such as mock objects, nDumbster can be used to validate our system configuration up to the SMTP protocol. As it acts like a real SMTP server, it validate that you use correctly your mail sending component.
nDumbster provide means to fetch messages send by your programs, and to check any properties of these messages.
nDumbster is written in C# and is open source. According to Dumbster license, it is distributed under the Apache License 2.0.
nDumbter has been tested with .Net Framework version 1.1 and 2.0, and should be
easilly compiled with .Net 1.0 or Mono.
The following examples shows how to use nDumbster and NUnit to test how your function sendMessage.
public class SimpleSmtpServerTest
public void Setup()
smtpServer = SimpleSmtpServer.Start();
public void TearDown()
public void SendEmail()
// Use you own code
sendMessage(25, "email@example.com", "Test", "Test Body", "firstname.lastname@example.org");
Assert.AreEqual(1, smtpServer.ReceivedEmailCount, "1 mails sent");
SmtpMessage mail= (SmtpMessage)smtpServer.ReceivedEmail;
Assert.AreEqual("<email@example.com>", mail.Headers["To"], "Receiver");
Assert.AreEqual("<firstname.lastname@example.org>", mail.Headers["From"], "Sender");
Assert.AreEqual("Test", mail.Headers["Subject"], "Subject");
Assert.AreEqual("Test Body", mailUser.Body, "Body");
nDumbster can be downloaded from sourceforge