nDumbster .Net fake SMTP server

SimpleSmtpServer Class

[This is preliminary documentation and subject to change.]

Dummy SMTP server for testing purposes.

For a list of all members of this type, see SimpleSmtpServer Members.


public class SimpleSmtpServer

Thread Safety

This type is safe for multithreaded operations.

The server create a thread to handle message reception and all access to messages list is protected.


The following examples shows how to use nDumbster and NUnit to test 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");


Namespace: nDumbster.smtp

Assembly: nDumbster (in nDumbster.dll)

See Also

SimpleSmtpServer Members | nDumbster.smtp Namespace