All Projects → cosullivan → Smtpserver

cosullivan / Smtpserver

Licence: mit
A SMTP Server component written in C#

Projects that are alternatives of or similar to Smtpserver

MailDemon
Smtp server for mass emailing, managing email lists and more. Built on .NET Core. Linux, MAC and Windows compatible.
Stars: ✭ 113 (-70.42%)
Mutual labels:  smtp, smtp-server
mailgrab
Simple and easy to use catch-all SMTP mail server and debugging tool
Stars: ✭ 92 (-75.92%)
Mutual labels:  smtp, smtp-server
SimpleKotlinMail
A simple, coroutine based Kotlin Email API for both client- and server-side projects
Stars: ✭ 56 (-85.34%)
Mutual labels:  smtp, smtp-server
Tmail
Golang SMTP server
Stars: ✭ 251 (-34.29%)
Mutual labels:  smtp, smtp-server
Notqmail
Collaborative open-source successor to qmail
Stars: ✭ 255 (-33.25%)
Mutual labels:  smtp, smtp-server
go-smtp-mock
SMTP mock server written on Golang. Mimic any 📤 SMTP server behavior for your test environment with fake SMTP server.
Stars: ✭ 76 (-80.1%)
Mutual labels:  smtp, smtp-server
smtpd
SMTP server (library) for receiving emails, written in pure PHP.
Stars: ✭ 94 (-75.39%)
Mutual labels:  smtp, smtp-server
Mailproxy
mailproxy is a simple SMTP proxy. It receives emails through an unencrypted, unauthenticated SMTP interface and retransmits them through a remote SMTP server that requires modern features such as encryption and/or authentication. mailproxy is primarily useful for enabling email functionality in legacy software that only supports plain SMTP.
Stars: ✭ 170 (-55.5%)
Mutual labels:  smtp, smtp-server
Maildev
📫 SMTP Server + Web Interface for viewing and testing emails during development.
Stars: ✭ 3,102 (+712.04%)
Mutual labels:  smtp, smtp-server
docker-protonmail-bridge
Run ProtonMail Bridge in a docker container
Stars: ✭ 34 (-91.1%)
Mutual labels:  smtp, smtp-server
Magento 2 Smtp
Magento 2 SMTP Extension helps the owner of store simply install SMTP (Simple Mail Transfer Protocol) server which transmits the messages into codes or numbers.
Stars: ✭ 228 (-40.31%)
Mutual labels:  smtp, smtp-server
haraka-plugin-mongodb
Plugin for the Haraka SMTP server to store incoming and outgoing emails to MongoDB
Stars: ✭ 25 (-93.46%)
Mutual labels:  smtp, smtp-server
Aiosmtpd
A reimplementation of the Python stdlib smtpd.py based on asyncio.
Stars: ✭ 195 (-48.95%)
Mutual labels:  smtp, smtp-server
ControlCenter
Mirrored from GitLab! Monitoring and automation for Open Source email servers, starting with Postfix. Please do not submit issues or PRs here - join us at: https://gitlab.com/lightmeter
Stars: ✭ 88 (-76.96%)
Mutual labels:  smtp, smtp-server
Smtpd
A Lightweight High Performance ESMTP email server
Stars: ✭ 175 (-54.19%)
Mutual labels:  smtp, smtp-server
blackhole
Blackhole is an MTA written on top of asyncio, utilising async and await statements that dumps all mail it receives to /dev/null.
Stars: ✭ 61 (-84.03%)
Mutual labels:  smtp, smtp-server
Go Guerrilla
Mini SMTP server written in golang
Stars: ✭ 2,173 (+468.85%)
Mutual labels:  smtp, smtp-server
Docker Postfix
Simple SMTP server / postfix null relay host for your Docker and Kubernetes containers. Based on Alpine Linux.
Stars: ✭ 163 (-57.33%)
Mutual labels:  smtp, smtp-server
yggmail
End-to-end encrypted email for the mesh networking age
Stars: ✭ 72 (-81.15%)
Mutual labels:  smtp, smtp-server
smtp-dkim-signer
SMTP-proxy that DKIM-signs e-mails before submission to an upstream SMTP-server.
Stars: ✭ 28 (-92.67%)
Mutual labels:  smtp, smtp-server

What is SmtpServer?

NuGet

SmtpServer is a simple, but highly functional SMTP server implementation. Written entirely in C# it takes full advantage of the .NET TPL to achieve maximum performance.

SmtpServer is available via NuGet

Whats New?

See here for whats new in Version 8.

What does it support?

SmtpServer currently supports the following ESMTP extensions:

  • STARTTLS
  • SIZE
  • PIPELINING
  • 8BITMIME
  • AUTH PLAIN LOGIN

How can it be used?

At its most basic, it only takes a few lines of code for the server to be listening to incoming requests.

var options = new SmtpServerOptionsBuilder()
    .ServerName("localhost")
    .Port(25, 587)
    .Build();

var smtpServer = new SmtpServer.SmtpServer(options, ServiceProvider.Default);
await smtpServer.StartAsync(CancellationToken.None);

What hooks are provided?

There are three hooks that can be implemented; IMessageStore, IMailboxFilter, and IUserAuthenticator.

var options = new SmtpServerOptionsBuilder()
    .ServerName("localhost")
    .Port(25, 587)
    .Port(465, isSecure: true)
    .Certificate(CreateX509Certificate2())
    .Build();

var serviceProvider = new ServiceProvider();
serviceProvider.Add(new SampleMessageStore());
serviceProvider.Add(new SampleMailboxFilter());
serviceProvider.Add(new SampleUserAuthenticator());

var smtpServer = new SmtpServer.SmtpServer(options, serviceProvider);
await smtpServer.StartAsync(CancellationToken.None);
public class SampleMessageStore : MessageStore
{
    public override async Task<SmtpResponse> SaveAsync(ISessionContext context, IMessageTransaction transaction, ReadOnlySequence<byte> buffer, CancellationToken cancellationToken)
        {
            await using var stream = new MemoryStream();

            var position = buffer.GetPosition(0);
            while (buffer.TryGet(ref position, out var memory))
            {
                await stream.WriteAsync(memory, cancellationToken);
            }

            stream.Position = 0;

            var message = await MimeKit.MimeMessage.LoadAsync(stream, cancellationToken);
            Console.WriteLine(message.TextBody);
            
            return SmtpResponse.Ok;
        }
}
public class SampleMailboxFilter : IMailboxFilter, IMailboxFilterFactory
{
    public Task<MailboxFilterResult> CanAcceptFromAsync(ISessionContext context, IMailbox @from, int size, CancellationToken cancellationToken)
    {
        if (String.Equals(@from.Host, "test.com"))
        {
            return Task.FromResult(MailboxFilterResult.Yes);   
        }

        return Task.FromResult(MailboxFilterResult.NoPermanently);
    }

    public Task<MailboxFilterResult> CanDeliverToAsync(ISessionContext context, IMailbox to, IMailbox @from, CancellationToken token)
    {
        return Task.FromResult(MailboxFilterResult.Yes);
    }

    public IMailboxFilter CreateInstance(ISessionContext context)
    {
	return new SampleMailboxFilter();
    }
}
public class SampleUserAuthenticator : IUserAuthenticator, IUserAuthenticatorFactory
{
    public Task<bool> AuthenticateAsync(ISessionContext context, string user, string password, CancellationToken token)
    {
        Console.WriteLine("User={0} Password={1}", user, password);

        return Task.FromResult(user.Length > 4);
    }

    public IUserAuthenticator CreateInstance(ISessionContext context)
    {
	return new SampleUserAuthenticator();
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].