Styles in email using Octopus.Parameters["Octopus.Release.Notes"]


We have a custom C# script to send an email on deployments.

We using suggested objects to access data.
message.IsBodyHtml = true;
var body = "Release notes:<br/>"+ Octopus.Parameters["Octopus.Release.Notes"];

We define release notes nicely with lists and styling and new lines, but when we send an email all styles are stripped.
How do make sure that the release notes contain styles defined when writing them in the release, on email?
Is there something that we could use to keep them in html format in email ?

Hi VJ,

Thanks for getting in touch! The snippet you’ve sent looks like it should be sufficient to retain the HTML formatting in the email, so I’m not sure what’s causing this issue. Would you be willing to provide the full custom C# script you’re using, and I’ll be happy to look into it further?

I look forward to hearing back and getting to the bottom of this one!

Best regards,



Hope image is sufficient as code formatting failed for me in this text area :slight_smile:
As you can see - quite simple one.

Release notes in octopus looks like this :

But the email looks like everything is one line, no styles.

Hi VJ,

Thanks for following up! The only thing that sticks out is the missing semi-colon at smtpClient.Port = 25;, but I don’t think that would explain the missing HTML formatting. Would you be willing to provide a full verbose deployment log with debugging variables enabled to provide more context for us? The following doc page outlines how to produce and export this log.

If your log contains sensitive information, you can mark this thread as private or email us at support at octopus dot com and I’ll receive it there. :slight_smile:

I look forward to hearing back and finally getting to the bottom of this one!

Best regards,


The semi-colon is copy-paste issue, it is not occurring in script.

I don’t think it actually will help in any way, just checked the logs with extended variables.
Everything including variables seems to be well styled when logged, no issues or warnings, all variables look correct.
But it seems like html tags and styles being stripped on sendout, is there some sort of an equivalent of razor @html.raw or etc, that would maintain these styles when accessed via variable?

You could easily try to reproduce by using default C# email sending functionality and release notes with styles.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.