public override void ParseResponseDetails(string message) { var match = new Regex("(?<headers>.*?)\\r\\n\\r\\n(?<body>.*)\\.", RegexOptions.Singleline).Match(message); var headerSection = match.Groups["headers"].Value; var bodySection = match.Groups["body"].Value; var contentType = message.GetHeaderValue("content-type"); Email = new EmailModel { Date = headerSection.GetHeaderValue("date").ParseDateString(), Subject = headerSection.GetHeaderValue("subject").DecodeEncodedWord().ReplaceAllNewLines(), From = headerSection.GetHeaderValue("from").DecodeEncodedWord(), Boundary = headerSection.GetHeaderValue("content-type", "boundary"), ContentTransferEncoding = headerSection.GetHeaderValue("content-transfer-encoding"), ContentType = contentType, Charset = headerSection.GetHeaderValue("content-type", "charset"), IsMultipart = contentType.ToLowerInvariant().Contains("multipart/") }; EmailDecodingHelper.DecodeMailBody(bodySection, Email); }
public override void FetchMailBody(EmailModel email) { SendCommandAsync(new ImapFetchMailBodyCommand(email, r => EmailDecodingHelper.DecodeMailBody(r.MailBody, email))); }