Send Octopus Machine Name Deploy in Email

Hi,
I would like to send Octopus Machine Name in email subject and body.
I have add variable #{Octopus.Machine.Name} but don’t work.

Example:
Start Deploy to #{Octopus.Machine.Name}/#{Octopus.Environment.Name} #{Octopus.Project.Name} #{Octopus.Release.Number}

what am I doing wrong?

Thank’s

Best Regards,
Gennaro R.

Hi Gennaro,

Thanks for getting in touch! Since the email step isn’t run on a machine, the Octopus.Machine.Name system variable isn’t populated when the email step is executed. To include the machine names, probably the best option (assuming your email step is the first in the process) would be to insert a basic script step before the email which would be used to create an output variable storing the machine names.

Something like Set-OctopusVariable -name "MachineVariable" -value "#{Octopus.Machine.Name}". Then in your email step call the output variable via #{Octopus.Action[ScriptStepName].Output.MachineVariable}. (Replacing ScriptStepName here to match your step name that’s creating the output variable.)

I hope this helps! Let me know how you go or if you have any questions. :slight_smile:

Best regards,

Kenny

Hi Kenneth,
Thank’s this solution work. :smile:

Best Regards,
Gennaro

Hi Gennaro,

Sounds great, thanks for letting me know! If you have any questions or concerns in the future, please don’t hesitate to reach out. :slight_smile:

Best regards,

Kenny

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