private void AppendUid(Message message, string response) { var msgIdMatch = Regex.Match(response, @"UID ([0-9]+)"); if (msgIdMatch.Success) message.AddHeaderField("X-MSG-UID", msgIdMatch.Groups[1].Value); }
/// <summary> /// Generates the confirm read message. /// </summary> /// <returns></returns> public Message GenerateConfirmReadMessage() { Message message = new Message(); // Inverse the recipient and sender message.To.Add(this.ConfirmRead); message.From = this.To[0]; // Create the subject message.Subject = "Read: " + this.Subject; // Adds the original message ID message.AddHeaderField("In-Reply-To", this.MessageId); // Prepare the bodies DateTime dateReceived = this.Date; DateTime dateRead = DateTime.Now; message.BodyText.Text = string.Format(@"Your message To: {0} Subject: {1} Sent: {2} {3} was read on {4} {5}.", this.To[0].Email, this.Subject, dateReceived.ToShortDateString(), dateReceived.ToShortTimeString(), dateRead.ToShortDateString(), dateRead.ToShortTimeString()); message.BodyHtml.Text = string.Format(@"<P><FONT SIZE=3D2>Your message<BR> <BR> To: {0}<BR> Subject: {1}<BR> Sent: {2} {3}<BR> <BR> was read on {4} {5}.</FONT> </P>", this.To[0].Email, this.Subject, dateReceived.ToShortDateString(), dateReceived.ToShortTimeString(), dateRead.ToShortDateString(), dateRead.ToShortTimeString()); // Create the repot mime part MimePart notificationPart = new MimePart(); notificationPart.ContentType.MimeType = "message/disposition-notification"; notificationPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable; notificationPart.TextContent = string.Format(@"Reporting-UA: {0}; ActiveUp.MailSystem Final-Recipient: rfc822;{1} Original-Message-ID: <{2}> Disposition: manual-action/MDN-sent-manually; displayed", "domain", this.To[0].Email, this.MessageId); message.UnknownDispositionMimeParts.Add(notificationPart); // Now we return the result return message; }
private void AppendGMailExtensions(Message message, string response) { var labelsMatch = Regex.Match(response, @"X-GM-LABELS \(([^\)]*?)\)"); if (labelsMatch.Success) message.AddHeaderField("X-GM-LABELS", labelsMatch.Groups[1].Value); var msgIdMatch = Regex.Match(response, @"X-GM-MSGID ([0-9]+)"); if (msgIdMatch.Success) message.AddHeaderField("X-GM-MSGID", Int64.Parse(msgIdMatch.Groups[1].Value).ToString("x")); }