Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

mabru47/SmtpServer.Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmtpServer.Net

SmtpServer.Net is a simple and high performant open source SMTP-Server for .Net Standard >=1.4 and .Net >=4.5.

Usage

The following example instantiates a new SmtpServer and adds some an example plugin.

class Program
{
    static void Main(string[] args)
    {
        var server = new SmtpServer(new ServerSettings()
        {
            Endpoint = IPAddress.Parse("127.0.0.1"),
            ServiceName = "ExampleService",
            ServiceDomain = "mx.example.org"
        });

        server.AddPluginAsync(new SpamhausPlugin()).Wait();
        server.AddPluginAsync(new ExampleMailProcessor()).Wait();

        server.Run();
    }
}

Example Plugin

class ExampleMailProcessor : IMailProcessor
{
    public async Task<MailProcessorResult> ProcessAsync(string from, string[] rcpt, Stream data)
    {
        var stringData = await new StreamReader(data).ReadToEndAsync();
        Console.WriteLine("Total length: " + stringData.Length);

        return MailProcessorResult.Okay;
    }
}

Builds

Get it via NuGet https://www.nuget.org/packages/Tireless.SmtpServer.Net/

PM> Install-Package Tireless.SmtpServer.Net

Build from Code

Just clone the repository and open the solution in Visual Studio 2017. Or use the dotnet client via command line.

About

An SMTP-Server for .Net Core

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages