public void OnTestInitialize()
 {
     _Server = new SmtpServerCore();
     _Messages = new List<SmtpMessage>();
     _Server.ReceiveMessage += _Server_ReceiveMessage;
     _Server.Start();
 }
Ejemplo n.º 2
0
        private static void StartEmailServer()
        {
            var host = Dns.GetHostEntry(
                ConfigurationManager.AppSettings["SmtpServerHost"]);

            var server = new SmtpServerCore(host.AddressList.First(x =>
                                                                   x.AddressFamily == AddressFamily.InterNetwork),
                                            int.Parse(ConfigurationManager.AppSettings["SmtpServerPort"]));

            server.ReceiveMessage += (s, e) =>
            {
                var json = JsonConvert.SerializeObject(e.Message);

                var container = GetContainer();

                var blob = container.GetBlockBlobReference(
                    Guid.NewGuid().ToString("N") + ".json");

                blob.UploadText(json);

                Console.WriteLine(MiscHelpers.GetSavedToQueueMessage(e.Message));
            };

            server.Start();
        }
Ejemplo n.º 3
0
        public SmtpServerCoreTest()
        {
            Encoding.RegisterProvider(new BodyNamePatchedCodePagesEncodingProvider(
                                          CodePagesEncodingProvider.Instance,
                                          new[] { new EncodingBodyNamePatch(50220, "iso-2022-jp") }));

            _Server   = new SmtpServerCore();
            _Messages = new List <SmtpMessage>();
            _Server.ReceiveMessage += _Server_ReceiveMessage;
            _Server.Start();
        }