public void OnTestInitialize() { _Server = new SmtpServerCore(); _Messages = new List<SmtpMessage>(); _Server.ReceiveMessage += _Server_ReceiveMessage; _Server.Start(); }
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(); }
public SmtpServerSession(SmtpServerCore server, TcpClient tcpClient) { this.Reset(); this.Server = server; this.TcpClient = tcpClient; this.BaseStream = tcpClient.GetStream(); this.Reader = new StreamReader(tcpClient.GetStream()); }
public SmtpServerSession(SmtpServerCore server, TcpClient tcpClient) { this.Reset(); this.Server = server; this.TcpClient = tcpClient; this.BaseStream = tcpClient.GetStream(); this.Reader = new StreamReader(tcpClient.GetStream()); }
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(); }