Handling Feedback Loop Reports with a Plugin

One of the cool new events supported by the new IDynamic plugin API interface is OnFeedbackLoopParsed which can be fired each time a feedback loop report is received and processed by Hurricane MTA Server.

The following code illustrates how the event can be handled by your code. If you have not read about the new IDynamic plugin API interface yet I would suggest that you do because it contains the basic information on the OnDynamicEvent() method which is used to fire the feedback loop events.

public class Feedbackloop : PluginBase, IDynamic 
{

     public object OnDynamicEvent(DynamicEventId eventId, ref Dictionary eventParams)
     {
         //Tell the system we only want to get feedback loop events
         if (eventId == DynamicEventId.Init)
         {
             eventParams[DynamicEventId.OnFeedbackLoopParsed.ToString()] = 1;
         }
         //Handle feedback loop event
         if (eventId == DynamicEventId.OnFeedbackLoopParsed)
         {
             string OrignalRecipient = eventParams["OriginalRecipient"].ToString();
             string OrignalMessageId = eventParams["SystemMessageID"].ToString();
             string CustomMailingID = eventParams["CustomMailingID"].ToString();
             string CustomMessageID = eventParams["CustomMessageID"].ToString();
             string UserAgent = eventParams["User-Agent"].ToString();
             string Type = eventParams["Type"].ToString();

             /// To-do: Do database work to unsubscribe user.

         }
         return null;
     }

}

Also, in case you missed it, find out all the info on the new feedback loop processing and reporting in Hurricane MTA Server.