nDumbster, .Net C# SMTP Fake server

.Net Email Testing


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
        SimpleSmtpServer smtpServer;

        public void Setup()

            smtpServer = SimpleSmtpServer.Start();


        public void TearDown()

        public void SendEmail()
            // Use you own code 
            sendMessage(25, "sender@here.com", "Test", "Test Body", "receiver@there.com");
            Assert.AreEqual(1, smtpServer.ReceivedEmailCount, "1 mails sent");
            SmtpMessage mail= (SmtpMessage)smtpServer.ReceivedEmail[0];
            Assert.AreEqual("<receiver@there.com>", mail.Headers["To"], "Receiver");
            Assert.AreEqual("<sender@here.com>", mail.Headers["From"], "Sender");
            Assert.AreEqual("Test", mail.Headers["Subject"], "Subject");

            Assert.AreEqual("Test Body", mailUser.Body, "Body");


nDumbster can be downloaded from sourceforge site.