Beispiel #1
0
 public void Update(Mdn mdn)
 {
     try
     {
         Store.Mdns.Update(mdn);
     }
     catch (Exception ex)
     {
         throw CreateFault("Update", ex);
     }
 }
Beispiel #2
0
 public void Start(Mdn[] mdns)
 {
     try
     {
         Store.Mdns.Start(mdns);
     }
     catch (Exception ex)
     {
         throw CreateFault("Start", ex);
     }
 }
Beispiel #3
0
 static DSNMessage CreateNotificationMessage(Mdn mdn, TimeoutSettings settings)
 {
     var perMessage = new DSNPerMessage(settings.ProductName, mdn.MessageId);
     var perRecipient = new DSNPerRecipient(DSNStandard.DSNAction.Failed, DSNStandard.DSNStatus.Permanent
                                            , DSNStandard.DSNStatus.NETWORK_EXPIRED_PROCESSED,
                                            MailParser.ParseMailAddress(mdn.Recipient));
     //
     // The nature of Mdn storage in config store does not result in a list of perRecipients
     // If you would rather send one DSN with muliple recipients then one could write their own Job.
     //
     var notification = new DSN(perMessage, new List<DSNPerRecipient> { perRecipient });
     var sender = new MailAddress(mdn.Sender);
     var notificationMessage = new DSNMessage(sender.Address, new MailAddress("Postmaster@" + sender.Host).Address, notification);
     notificationMessage.AssignMessageID();
     notificationMessage.SubjectValue = string.Format("{0}:{1}", "Rejected", mdn.SubjectValue);
     notificationMessage.Timestamp();
     return notificationMessage;
 }
Beispiel #4
0
 public static void ExecDelete(this Table<Mdn> table, Mdn mdn)
 {
     table.Context.ExecuteCommand(Sql_DeleteMdn, mdn);
 }
        public void TestEndToEnd_GatewayIsDestination_Is_True_And_TimelyAndReliable_Not_Requestd()
        {
            CleanMessages(m_agent.Settings);
            m_agent.Settings.InternalMessage.EnableRelay = true;
            m_agent.Settings.Outgoing.EnableRelay = true;
            m_agent.Settings.Notifications.AutoResponse = true;
            m_agent.Settings.Notifications.AlwaysAck = true;
            m_agent.Settings.Notifications.GatewayIsDestination = true;
            m_agent.Settings.MdnMonitor = new ClientSettings();
            m_agent.Settings.MdnMonitor.Url = "http://localhost:6692/MonitorService.svc/Dispositions";

            //
            // Process loopback messages.  Leaves un-encrypted mdns in pickup folder
            // Go ahead and pick them up and Process them as if they where being handled
            // by the SmtpAgent by way of (IIS)SMTP hand off.
            //
            string textMessage = string.Format(string.Format(TestMessage, Guid.NewGuid()), Guid.NewGuid());
            var sendingMessage = LoadMessage(textMessage);
            Assert.DoesNotThrow(() => RunEndToEndTest(sendingMessage));

            //
            // grab the clear text mdns and delete others.
            //
            foreach (var pickupMessage in PickupMessages())
            {
                string messageText = File.ReadAllText(pickupMessage);
                if (messageText.Contains("disposition-notification"))
                {
                    Assert.DoesNotThrow(() => RunMdnOutBoundProcessingTest(LoadMessage(messageText)));
                }
            }

            //
            // Now the messages are encrypted and can be handled
            // Processed Mdn's will be recorded by the MdnMonitorService
            //
            foreach (var pickupMessage in PickupMessages())
            {
                string messageText = File.ReadAllText(pickupMessage);
                CDO.Message message = LoadMessage(messageText);

                Assert.DoesNotThrow(() => RunMdnInBoundProcessingTest(message));
                var envelope = new CDOSmtpMessage(message).GetEnvelope();
                var mdn = MDNParser.Parse(envelope.Message);

                //
                // Only expect processed MDNs
                //
                Assert.Equal(MDNStandard.NotificationType.Processed, mdn.Disposition.Notification);
                TestMdnTimelyAndReliableExtensionField(mdn, false);
            }

            //
            // Test Mdn data is processed
            // Remember above (Settings.Notifications.GatewayIsDestination = true)
            // but message did not request TimelyAndReliable
            //
            var messageEnvelope = new CDOSmtpMessage(sendingMessage).GetEnvelope();
            foreach (var recipient in messageEnvelope.Recipients)
            {
                var queryMdn = new Mdn(messageEnvelope.Message.IDValue
                        , recipient.Address
                        , messageEnvelope.Message.FromValue
                        , MdnStatus.Processed);

                var mdnManager = CreateConfigStore().Mdns;
                var mdn = mdnManager.Get(queryMdn.MdnIdentifier);
                Assert.NotNull(mdn);
                Assert.Equal("processed", mdn.Status, StringComparer.OrdinalIgnoreCase);
                Assert.Equal(false, mdn.NotifyDispatched);
            }

            m_agent.Settings.InternalMessage.EnableRelay = false;
        }
Beispiel #6
0
 public static void ExecDelete(this Table <Mdn> table, Mdn mdn)
 {
     table.Context.ExecuteCommand(Sql_DeleteMdn, mdn);
 }
Beispiel #7
0
	    public void Delete(Mdn obj)
	    {
		    throw new System.NotImplementedException();
	    }
Beispiel #8
0
	    public Mdn Update(Mdn obj)
	    {
		    throw new System.NotImplementedException();
	    }