internal Notification(MimeEntity explanation, HeaderCollection fields) { m_explanation = explanation; m_fields = fields; m_disposition = MDNParser.ParseDisposition(m_fields.GetValue(MDNStandard.Fields.Disposition)); // // Optional data // string field = m_fields.GetValue(MDNStandard.Fields.ReportingAgent); if (!string.IsNullOrEmpty(field)) { m_reportingAgent = MDNParser.ParseReportingUserAgent(field); } field = m_fields.GetValue(MDNStandard.Fields.Gateway); if (!string.IsNullOrEmpty(field)) { m_gateway = MDNParser.ParseMdnGateway(field); } field = m_fields.GetValue(MDNStandard.Fields.FinalRecipient); if (!string.IsNullOrEmpty(field)) { m_finalRecipient = MDNParser.ParseFinalRecipient(field); } }
/// <summary> /// Create an ACK MDN notification /// </summary> /// <param name="source">The MTA or MUA that is generating this ack</param> /// <param name="textExplanation">(optional) Text message to accompany the Ack</param> /// <param name="notificationType">processed, dispatched or failed</param> /// <returns>Notification object</returns> public static Notification CreateAck(ReportingUserAgent source, string textExplanation, MDNStandard.NotificationType notificationType) { if (source == null) { throw new ArgumentNullException("source"); } Notification notification = new Notification(notificationType); notification.ReportingAgent = source; if (!string.IsNullOrEmpty(textExplanation)) { notification.Explanation = textExplanation; } return(notification); }