4

I am trying to create a custom WFFM SaveAction that sends an email, and I would like to still use the Email Editor. The problem is, how do I get the information entered through the editor in my custom SaveAction. If I inherit from SendMail, I can't add the SaveAction to the form. I get in the log:

The constructor parameters may not match or it may be an abstract class.

So I just step back to using ISaveAction, but then I can't access the data from the editor. It seems like I need the IMailSender and IEmailAttributes that SendMail takes, but I can't seem to make that work. How do I access the data from the email editor in a custom SaveAction?

WFFM 8.1

1 Answer 1

4

You need to provide the dependencies in config. For example, the out of the box Send Email Message save action has the following definition in Sitecore:

Send Email Definition

If you check in Sitecore.WFFM.Dependencies.config you will find a matching definition:

<sitecore>
  <wffm>
    <!--Save actions constructor configuration-->
    <actions>
      ...
      <sendMessage type="Sitecore.WFFM.Actions.SaveActions.SendMessage, Sitecore.WFFM.Actions">
        <param name="settings" ref="/sitecore/wffm/settings" />
        <param name="mailSender" ref="/sitecore/wffm/mailSender" />
      </sendMessage>
      ...
    </actions>
  </wffm>
</sitecore>

If you create a custom save action then create a duplicate of this node and change the type to your own implementation and change the Factory Object Name to point to your new config node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.