Im trying to create a custom mail system in Sitecore. For this i want to be able to use razor code inside my mail item in the Sitecore backend. This code will be place inside the body field which will be a rich text. Currently I'm working on a Sitecore 8 instance.
Now here is my problem. Whenever I put a piece of code like:
@for (var i = 0; i > @model.persons.count; i++){
the rich text fields changes the line of code to:
@for (var i = 0; i < @model.documents.count; i++){
or even worse..
Does anybody have an idea why this is happening and what I can do to prevent this. Cause now it changes every time somebody wants to make a change to the email message and it is quite annoying.
Thanks in advance.
In this scenario I would use some kind of token in the rich text email message field. E.g $persondata$.
Then I would use a pipeline processor to replace the tokens in the email with the real data. This keeps it nice and clean and is easier for editors.