User-defined variable in email

I am able to get a user defined variable in a Powershell script with $OctopusParameters[“Environment”], but this doesn’t work in the Email step. I get an email with the moniker in it.

What Syntax do I use to get access to this in the email step ?

Also, I’d like to include the packages that were part of the Release in the email like:

Release x.y - Deployed to Environment XXXXX
Packages in this Release:
1 - Package x.y
2- Package y.z

I realize there is a 1-Many relationship between the release and the packages and there is no way to loop in the email step.
Is there some PackageDetails variable or something that could get me this info? thanks.

Hi Gavin,

In your email step you can use:

#{VariableName}

E.g.,:

#{Octopus.Environment.Name}

Including packages is a bit tricky at the moment; you’ll need to do it like this:

#{Octopus.Steps[0].Package.NuGetPackageId}
#{Octopus.Steps[0].Package.NuGetPackageVersion}

Repeating this for each step using a 0-based index.

Hope that helps,

Paul