Skip to content

NickLydon/SmtpInMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status

NuGet version

SmtpInMemory

Simple SMTP server - can query received emails in memory

##In F# #

let port = 9000
let server = SMTP.Server(port) //port is optional - will default to 25
//send emails
let emails = server.GetEmails()

##In C# #

var port = 9000;
var server = new SMTP.Server(port); //port is optional - will default to 25
//send emails
var emails = server.GetEmails()

As a proxy email server

The server can forward emails onwards if the hostname and port number of the destination server are provided:

let proxyPort = 9000
let destinationServer = { Port = 25; Host = "mail.mycompany.com" }
let server = SMTP.Server(proxyPort,destinationServer)
//send emails
let emails = server.GetEmails()

Registering for events

The server exposes an Rx stream for the emails received:

using (sut.EmailReceived.Subscribe(actual =>
{
    AssertEmailsAreEqual(actual, msg);
}));

Look at the tests to see emails being sent. MailKit is the library used to send emails.

MIT Licensed

About

Simple SMTP server - can query received emails in memory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published