Пример #1
0
        /// <summary>
        /// To simplify outbound mail sending, SMTP Server allows you to drop new messages into a pickup folder
        /// You don't need to use SmtpClient or some other SMTP client
        /// </summary>
        public void SendFailure(IncomingMessage envelope, string pickupFolder, DirectAddressCollection recipients)
        {
            if (string.IsNullOrEmpty(pickupFolder))
            {
                throw new ArgumentException("value null or empty", "pickupFolder");
            }

            if (recipients.IsNullOrEmpty())
            {
                return;
            }

            if (recipients != null)
            {
                DSNMessage notification = this.ProduceFailure(envelope, recipients);

                string filePath = Path.Combine(pickupFolder, Extensions.CreateUniqueFileName());
                notification.Save(filePath);
            }


            //Or maybe
            //
            // m_router.Route(message, envelope, routedRecipients);
            //
            // This would avoid loopback encrypt/decrypt...
            //
            // ISmtpMessage message
            // MessageEnvelope envelope
            // DirectAddressCollection routedRecipients, but would use DSN in-reply-to:
            //
        }
        /// <summary>
        /// To simplify inbound mail sending, SMTP Server allows you to drop new messages into a pickup folder
        /// You don't need to use SmtpClient or some other SMTP client
        /// </summary>
        public void SendFailure(OutgoingMessage envelope, string pickupFolder, DirectAddressCollection recipients) 
        {
            if (string.IsNullOrEmpty(pickupFolder))
            {
                throw new ArgumentException("value null or empty", "pickupFolder");
            }

            if (recipients.IsNullOrEmpty())
            {
                return;
            }

            if (recipients != null && envelope.UsingDeliveryStatus)
            {
                DSNMessage notification = this.ProduceFailure(envelope, recipients);
                           

                string filePath = Path.Combine(pickupFolder, Extensions.CreateUniqueFileName());
                notification.Save(filePath);
            }
            

            //Or maybe
            //
            // m_router.Route(message, envelope, routedRecipients);  
            // 
            // This would avoid loopback encrypt/decrypt...
            //
            // ISmtpMessage message
            // MessageEnvelope envelope 
            // DirectAddressCollection routedRecipients, but would use DSN in-reply-to:
            //
            
            
        }
 /// <summary>
 /// To simplify outbound mail sending, SMTP Server allows you to drop new messages into a pickup folder
 /// You don't need to use SmtpClient or some other SMTP client
 /// </summary>
 public void Send(IncomingMessage envelope, string pickupFolder, DirectAddressCollection senders, MDNStandard.NotificationType notificationType)
 {
     if (string.IsNullOrEmpty(pickupFolder))
     {
         throw new ArgumentException("value null or empty", "pickupFolder");
     }
     
     if (senders.IsNullOrEmpty())
     {
         return;
     }
     
     foreach (NotificationMessage notification in this.Produce(envelope, senders.AsMailAddresses(), notificationType))
     {
         string filePath = Path.Combine(pickupFolder, Extensions.CreateUniqueFileName());
         notification.Save(filePath);
     }
 }
Пример #4
0
        /// <summary>
        /// To simplify outbound mail sending, SMTP Server allows you to drop new messages into a pickup folder
        /// You don't need to use SmtpClient or some other SMTP client
        /// </summary>
        public void Send(IncomingMessage envelope, string pickupFolder, DirectAddressCollection senders, MDNStandard.NotificationType notificationType)
        {
            if (string.IsNullOrEmpty(pickupFolder))
            {
                throw new ArgumentException("value null or empty", "pickupFolder");
            }

            if (senders.IsNullOrEmpty())
            {
                return;
            }

            foreach (NotificationMessage notification in this.Produce(envelope, senders.AsMailAddresses(), notificationType))
            {
                string filePath = Path.Combine(pickupFolder, Extensions.CreateUniqueFileName());
                notification.Save(filePath);
            }
        }
Пример #5
0
        string CollectNoCertInformation(DirectAddressCollection recipients)
        {
            if (recipients.IsNullOrEmpty())
            {
                return(string.Empty);
            }

            StringBuilder builder = new StringBuilder();

            foreach (DirectAddress recipient in recipients)
            {
                if (!recipient.HasCertificates)
                {
                    builder.Append(recipient.Address).Append(';');
                }
            }

            return(builder.ToString());
        }
Пример #6
0
        /// <summary>
        /// To simplify inbound mail sending, SMTP Server allows you to drop new messages into a pickup folder
        /// You don't need to use SmtpClient or some other SMTP client
        /// </summary>
        public void SendFailure(OutgoingMessage envelope, string pickupFolder)
        {
            if (string.IsNullOrEmpty(pickupFolder))
            {
                throw new ArgumentException("value null or empty", "pickupFolder");
            }

            DirectAddressCollection recipients = envelope.RejectedRecipients;

            if (recipients.IsNullOrEmpty())
            {
                return;
            }

            if (recipients != null && envelope.UsingDeliveryStatus)
            {
                DSNMessage notification = this.ProduceFailure(envelope, recipients);


                string filePath = Path.Combine(pickupFolder, Extensions.CreateUniqueFileName());
                notification.Save(filePath);
            }
        }
Пример #7
0
        internal void UpdateRoutingHeaders(DirectAddressCollection rejectedRecipients)
        {
            if (rejectedRecipients.IsNullOrEmpty()) 
            {
                return;
            }

            this.UpdateRecipientHeader(To, MailStandard.Headers.To, rejectedRecipients);
            this.UpdateRecipientHeader(Cc, MailStandard.Headers.Cc, rejectedRecipients);
            this.UpdateRecipientHeader(Bcc, MailStandard.Headers.Bcc, rejectedRecipients);
        }
Пример #8
0
 string CollectNoCertInformation(DirectAddressCollection recipients)
 {
     if (recipients.IsNullOrEmpty())
     {
         return string.Empty;
     }
     
     StringBuilder builder = new StringBuilder();
     foreach(DirectAddress recipient in recipients)
     {
         if (!recipient.HasCertificates)
         {
             builder.Append(recipient.Address).Append(';');
         }
     }
     
     return builder.ToString();
 }