Discovering rule that triggered email action

Topics: Customizing Orchard, Writing modules
Sep 13, 2012 at 8:05 PM

I have a custom module that implements the IMessageEventHandler interface to intercept emails and add custom processing. Is there a way to find out what Rule triggered the event and/or the content item associated with the rule?



Sep 14, 2012 at 1:39 AM

It shouldn't matter. Why do you need it?

Sep 20, 2012 at 11:55 PM

I'm trying to intercept emails and add PDF attachments for certain custom content types. 

Sep 21, 2012 at 7:34 PM

Cool, but that doesn't tell me why you need to access the rule.

Sep 23, 2012 at 2:30 AM

I would need to read the content items that triggered the rule in order to attach the required PDFs.

Sep 23, 2012 at 3:59 AM

That doesn't mean you need a reference to the rule. You can already get the content item through tokens.

Sep 23, 2012 at 6:05 AM

So you're saying to add the content ID to the, say, the subject line and load it this way?

Sep 23, 2012 at 6:21 AM

No. You are going to have to build an action to do that PDF thing you need to do. That action will receive context, which has the content id. Look at existing actions, for example in Orchard.Rules.