Esempio n. 1
0
        public override SMTPResponse DoExecute(SMTPTransaction transaction, string parameters)
        {
            if (string.IsNullOrWhiteSpace(parameters))
            {
                return(new SMTPResponse(SMTPStatusCode.SyntaxError));
            }

            transaction.Reset();
            transaction.Initialize(parameters);

            return(new SMTPResponse(SMTPStatusCode.Okay, transaction.Settings.Greet));
        }
Esempio n. 2
0
        public void TestInitialize()
        {
            using (ShimsContext.Create())
            {
                var server      = new ShimSMTPServer();
                var settings    = new StubIReceiveSettings();
                var transaction = new SMTPTransaction(server, settings);

                const string clientId = "ClientID";

                Assert.False(transaction.Initialized);

                transaction.Initialize(clientId);

                Assert.True(transaction.Initialized);
                Assert.Equal(clientId, transaction.ClientIdentifier);
            }
        }
Esempio n. 3
0
        public override SMTPResponse DoExecute(SMTPTransaction transaction, string parameters)
        {
            if (string.IsNullOrWhiteSpace(parameters))
            {
                return(new SMTPResponse(SMTPStatusCode.SyntaxError));
            }

            transaction.Reset();
            transaction.Initialize(parameters);

            var ehlos = Server.GetListProperty <Func <SMTPTransaction, string> >("EHLOLines");
            var l     = new List <string> {
                transaction.Settings.Greet
            };

            l.AddRange(ehlos.Select(e => e(transaction)).Where(e => !string.IsNullOrEmpty(e)));

            return(new SMTPResponse(SMTPStatusCode.Okay, l.ToArray()));
        }