Exemple #1
0
        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();
        }
Exemple #2
0
 public Sender(OutstandingWork work)
 {
     _work = work;
 }
Exemple #3
0
 public SampleMessageStore(OutstandingWork buffer)
 {
     _buffer = buffer;
 }