Esempio n. 1
0
 private OutgoingMessage BuildFailedOutgoingMessage(MessageEnvelope envelope)
 {
     return new OutgoingMessage(
         envelope.Message, 
         envelope.Recipients, //not used but required for validation
         envelope.Recipients, //All are rejected.
         envelope.Sender,
         envelope.ShouldDeliverFailedStatus(m_settings.Notifications));
 }
Esempio n. 2
0
        protected virtual void RejectMessage(ISmtpMessage message, MessageEnvelope envelope, bool? incoming)
        {
            try
            {
                message.Reject();

                Auditor.ForEach(a => a.Log(AuditNames.Message.GetRejectedMessage(incoming), a.BuildAuditLogMessage.Build(message)));
                
                Logger.Debug("Rejected Message");


                if (!incoming.GetValueOrDefault(false) && envelope.ShouldDeliverFailedStatus(m_settings.Notifications))
                {
                    var outgoingMessage = BuildFailedOutgoingMessage(envelope);
                    SendDeliveryStatus(outgoingMessage);
                }
                else
                {
                    this.CopyMessage(message, m_settings.BadMessage);
                }

            }
            catch
            {
            }
        }