I'm trying to include hyperlinks in my k2 mail events. The number one reason we're struggling with k2 adoption is people currently have to copy and paste URLs from k2 notifications to their browsers. Since the html wysiwyg lacks any real html capabilities, I'm trying to find a simple workaround.
I started by trying to create a hyperlink within a data field and including the field within the email body. However, data fields are HTML encoded, so that didn't work. It's also worth noting that data fields are html encoded, but line breaks aren't replaced by html breaks (<br/>). So, that is also part of my goal here.
Next, I tried using a regular expression to replace URLs with hyperlinks in the code behind. That didn't work because I was dynamically creating the URL within the email body. For example, I was using a URL data field and appending the process instance ID to the query string. The problem is that each field is wrapped in span tags, so my regular expression wasn't picking up the process instance ID on the URL.
My solution now is to use a server event to construct the URL in a single datafield. Then I include the datafield in the email body. In the code behind, I use my regular expression to automatically convert URLs to hyperlinks and convert line breaks to HTML line breaks.
My two questions:
1) Does anyone have a simpler solution?
2) Is there a way to add my code to the default generated mail event code so I don't have to manually add my code every time?