static void Main(string[] args) { Console.WriteLine("Hello SMTP World !"); OutstandingWork buffer = new OutstandingWork(); var options = new SmtpServerOptionsBuilder() .CommandWaitTimeout(TimeSpan.FromSeconds(1)) .ServerName("localhost") .Port(25, 587) .MessageStore(new SampleMessageStore(buffer)) .UserAuthenticator(new SampleUserAuthenticator()) .Build(); var smtpServer = new SmtpServer(options); TaskFactory factory = new TaskFactory(); factory.StartNew(() => { new Sender(buffer).SendAndWait(); }); smtpServer.StartAsync(CancellationToken.None).GetAwaiter().GetResult(); }
public Sender(OutstandingWork work) { _work = work; }
public SampleMessageStore(OutstandingWork buffer) { _buffer = buffer; }