Accessing output variables in email subject and body


We have an issue where all of a sudden an output variable for subject and body of an email don’t get replaced.

Version: Octopus v2018.4.6

In Step 1, two variables are set through a post-deployment script;
$cmdOutput = .\Application.exe -s -w
Set-OctopusVariable -name “Output” -value $cmdOutput
Set-OctopusVariable -name “Date” -value $(Get-Date -format yyyy-MM-dd)

Step 2 is set to only run if Step 1 fails, and is based on the “Send Email” template.
Subject is: #{Octopus.Action[Step 1].Output.Date}
Body is: #{Octopus.Action[Step 1].Output.Output}

This has worked fine until a little while ago when it just stopped replacing the values. Instead we get literally “#{Octopus.Action[Step 1].Output.Date}” as email subject.

It’s the same version of Octopus Deploy, and no changes has been made to the current project since it was working. Could a system-wide setting be the culprit?

Hi Rickard,

Thanks for getting in touch! At first look, I suspect that perhaps your step’s name itself was changed. If the output variable substitution syntax is targeting a step with the wrong name, it would give you the same behavior. Could you confirm if the step name matches?

If it does indeed match, could you attach your verbose deployment logs to give us more context as to what the issue could be? The following doc page outlines how to produce and export this log.

If this log contains sensitive information, feel free to mark this thread as private or email us at support at octopus dot com and I’ll pick it up from there. :slight_smile:

I look forward to hearing back!

Best regards,


Sorry for late answer.

The step name matches - and for some reason, everything is now working again, without any changes made.

If this happens again I’ll try to provide some logs to help with possible bug tracking.


Hi Rickard,

Thanks for following up and keeping me updated. No worries at all about the late answer! Great it works again. Don’t hesitate to reach out if you have any questions or concerns in the future. :slight_smile:

Best regards,


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