Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new message.
 /// </summary>
 public SmtpMessage(RawSmtpMessage rawSmtpMessage)
 {
     this.rawSmtpMessage = rawSmtpMessage;
     using (MailMessage mailMessage = MailMessageMimeParser.ParseMessage(new System.IO.StringReader(this.rawSmtpMessage.Data.ToString())))
     {
         this.Headers         = mailMessage.Headers;
         this.FromAddress     = new EmailAddress(mailMessage.From.Address);
         this.ToAddresses     = rawSmtpMessage.Recipients.ToArray();
         this.MessageParts    = mailMessage.Parts();
         this.LocalIPAddress  = rawSmtpMessage.LocalIPAddress;
         this.LocalPort       = rawSmtpMessage.LocalPort;
         this.RemoteIPAddress = rawSmtpMessage.RemoteIPAddress;
         this.RemotePort      = rawSmtpMessage.RemotePort;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new message.
        /// </summary>
        public SmtpMessage(RawSmtpMessage rawSmtpMessage)
        {
            this.rawSmtpMessage = rawSmtpMessage;
            var rawMessage = this.rawSmtpMessage.Data.ToString();

            rawMessage = rawMessage.TrimEnd('\r', '\n');
            using (MailMessage mailMessage = MailMessageMimeParser.ParseMessage(rawMessage))
            {
                this.Headers         = mailMessage.Headers;
                this.FromAddress     = new EmailAddress(mailMessage.From.Address);
                this.ToAddresses     = rawSmtpMessage.Recipients.ToArray();
                this.MessageParts    = mailMessage.Parts();
                this.LocalIPAddress  = rawSmtpMessage.LocalIPAddress;
                this.LocalPort       = rawSmtpMessage.LocalPort;
                this.RemoteIPAddress = rawSmtpMessage.RemoteIPAddress;
                this.RemotePort      = rawSmtpMessage.RemotePort;
            }
        }