1

I have a number of EXM Automated Email Campaigns which include links to Sitecore items that are protected by one or more Sitecore roles. It seems that when the emails are sent, all of the links are resolved to empty strings, instead of links to the correct sitecore items (which then requires login).

If I insert links to unsecured pages, the links works as expected.

Is there any way of disabling this security check when the emails are generated?

3

You can use the SecurityDisabler, which runs the code in the context of an administrator.

using (new Sitecore.Security.Accounts.SecurityDisabler()) { //Get your link here }

there is also a Sitecore.Security.Accounts.UserSwitcher(user), where you can have more control over the access rights for the context you run the code in.

More can be read about this in the Security API Cookbook (section 4.2 and 4.3): https://sdn.sitecore.net/upload/sitecore6/60/security_api_cookbook_sc60_and_later-a4.pdf

| improve this answer | |
  • Thank you Michael. It seems to do the trick. I would have liked a solution in which EXM could be configured, as I still see the SecurityDisabler as hack'ish (but it works). – pwind May 2 '17 at 5:46
  • 1
    @pwind In the next version of EXM you will be able to specify which user the emails should be rendered as – Jacob Nielsen May 2 '17 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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