Ejemplo n.º 1
0
        private void StartThread()
        {
            try
            {
                RawEmailMessage message=new RawEmailMessage();

                message.MailFrom=_envelopefrom;
                foreach (EmailAddress to in _mailto)
                {
                    message.RcptToAddresses.Add(to);
                }
                message.Content=_rawtext;

                _smtpserver.LogSmtpWrite+=new SmtpServer.LogHandler(_logwindow.LogSmtpWrite);

                _smtpserver.LogSmtpReceive+=new SmtpServer.LogHandler(_logwindow.LogSmtpReceive);

                _smtpserver.LogSmtpCompleted+=new SmtpServer.LogHandler(_logwindow.LogSmtpCompleted);

                _logwindow.LogInfo("Sending Email to "+_smtpserver.ToString()+"\r\n");

                message.Send(_smtpserver);
            }
            catch (Exception ex)
            {
                _logwindow.LogError(ex.Message+"\r\n");
            }
        }
		public void TestRawEmail() 
		{			
			FileInfo contentfile=new FileInfo(@"..\..\TestFiles\ImportedEmail.txt");
			Assert.IsTrue(contentfile.Exists);
			StreamReader sr=new StreamReader(contentfile.OpenRead());
			
			RawEmailMessage message=new RawEmailMessage();
			message.Content=sr.ReadToEnd();
			message.AddRcptToAddress(TestAddressHelper.GetToAddress());
			message.MailFrom=TestAddressHelper.GetFromAddress();
			message.Send(_smtpserver);

		}