示例#1
0
        /// <summary>
        /// Create PerRecipient Status part of (DSN) for this message - IF DSNs should be generated. 
        /// If no DSN should be generated, returns NULL. 
        ///   - If there are no recipients
        ///   - If the message is itself an MDN or DSN
        /// </summary>
        /// <param name="recipients">Final-Recipients to report on delivery status</param>
        /// <param name="textMessage">Optional text message to accompany the Ack</param>
        /// <param name="alwaysAck">Generate acks even when none were requested</param>
        /// <param name="action">DSN action</param>
        /// <param name="classSubCode">Status code class</param>
        /// <param name="subjectSubCode">Status code subject</param>
        /// <returns>An DSNMessage</returns>
        public IEnumerable<DSNPerRecipient> CreatePerRecipientStatus(IEnumerable<MailAddress> recipients, string textMessage
                                                                     , bool alwaysAck, DSNStandard.DSNAction action, int classSubCode, string subjectSubCode)
        {
            if (recipients == null)
            {
                throw new ArgumentException("senders");
            }        
            
            if (this.Message.IsMDN())
            {
                return null;
            }

            
            var perRecipients = recipients.Select(
                recipient => 
                new DSNPerRecipient(action, classSubCode, subjectSubCode, recipient)
                ).ToList();

            return perRecipients;


        }
示例#2
0
 /// <summary>
 /// Tests if this message IS an DSN
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 public static bool IsDSN(this Message message)
 {
     return(DSNStandard.IsReport(message));
 }
示例#3
0
 /// <summary>
 /// Provides the appropriate MTA-name-type value for the <paramref name="type"/>
 /// </summary>
 /// <param name="type">The MTA-name-type to translate</param>
 /// <returns>A string representation suitable for MTA-name-type header value</returns>
 public static string AsString(this DSNStandard.MtaNameType type)
 {
     return(DSNStandard.ToString(type));
 }
示例#4
0
 /// <summary>
 /// Provides the appropriate Action header value for the <paramref name="type"/>
 /// </summary>
 /// <param name="type">The DSN Action to translate</param>
 /// <returns>A string representation suitable for the Action header value</returns>
 public static string AsString(this DSNStandard.DSNAction type)
 {
     return(DSNStandard.ToString(type));
 }
示例#5
0
 ///<summary>
 /// Initialize the per-recipient-fields for DSN
 ///</summary>
 ///<param name="action">DSN Action</param>
 ///<param name="classSubCode">Status code class</param>
 ///<param name="subjectSubCode">Status code subject</param>
 ///<param name="finalRecipient">Final recipient field</param>
 public DSNPerRecipient(DSNStandard.DSNAction action, int classSubCode, string subjectSubCode , MailAddress finalRecipient)
 {
     Action = action;
     Status = DSNStandard.DSNStatus.GetStatus(classSubCode, subjectSubCode);
     FinalRecipient = finalRecipient;
 }
示例#6
0
	  ///<summary>
      ///</summary>
      ///<param name="action">The DSN action</param>
      ///<param name="status">The DSN status</param>
      ///<param name="finalRecipient">The final recipient of this set of DSN headers</param>
      public DSNRecipientHeaders(DSNStandard.DSNAction action, string status, MailAddress finalRecipient) 
	  {
		  this.action = action;
		  this.status = status;
		  this.finalRecipient = finalRecipient;
	  }