Octopus.Project.Name and other variables not being replaced in email body

Hi,

I read a couple of similar posts but my issue is slightly different. I’ve tried to setup an email to be sent upon completion of a process and on some of our projects, the Octopus.Project.Name (and others) variables are not being replaced in the email body, the email subject works as expected.

  • Neither HTML or Plain Text email types have variables in the body replaced
  • I’ve tried both individual email address and distribution groups
  • Email client settings have no impact.

The email template I have been testing with is shown below and this is exactly what’s displayed in the email client, no variables replaced.

A successful deployment of #{Octopus.Project.Name} in the #{Octopus.Environment.Name} environment on #{ | NowDate “HH dd-MMM-yyyy” } has occurred.

Resulting email as it’s displayed in email client.

Server Log:
[“ServerTasks-9911_3E54EYEKMZ”,“INF”,“2018-07-16T18:00:06.8822718+00:00”,“Deploy xxxxx release 1.1.2 to Development”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:06.9447596+00:00”,“Step 1: Manual Intervention does not apply to the current environment, and will not be executed”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“INF”,“2018-07-16T18:00:06.9447596+00:00”,“Step 2: Deploy to xxxxx was manually skipped, and will not be executed”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:06.9447596+00:00”,“Step 3: Deploy to xxxxx does not apply to the current environment, and will not be executed”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“PLN”,“2018-07-16T18:00:06.9447596+00:00”,“Step 4: Deployment Confirmation Email - All Environments”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1009642+00:00”,“Guided failure is enabled for this task”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“INF”,“2018-07-16T18:00:07.1165566+00:00”,“Octopus Server”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1165566+00:00”,“Octopus Server version: 2018.6.14+Branch.master.xxxxx.xxxxxxxx”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1165566+00:00”,“Environment Information:\r\n OperatingSystem: Microsoft Windows NT 6.3.9600.0\r\n OsBitVersion: x64\r\n Is64BitProcess: True\r\n CurrentUser: xxxxxx\r\n MachineName: xxxxxxx\r\n ProcessorCount: 2\r\n CurrentDirectory: xxxx\r\n TempDirectory: xxxxx\AppData\Local\Temp\\r\n HostProcessName: Octopus.Server\r\n PID: 3456”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“Email parameters:”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“Subject: Octopus Deploy - xxx in Development Environment”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“To: xxxxxx@xxxxxx.onmicrosoft.com”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“Cc: “,””,0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“Bcc: “,””,0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:07.1321805+00:00”,“Sending email message…”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“INF”,“2018-07-16T18:00:24.8383561+00:00”,“Email sent!”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:24.8383561+00:00”,“Successfully finished Deployment Confirmation Email - All Environments on the Octopus Server”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“FIN”,“2018-07-16T18:00:24.8383561+00:00”,“Finished”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“VBS”,“2018-07-16T18:00:24.9789176+00:00”,“Deployment Confirmation Email - All Environments completed”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“FIN”,“2018-07-16T18:00:24.9789176+00:00”,“Finished”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“INF”,“2018-07-16T18:00:25.1819462+00:00”,“The deployment completed successfully.”,"",0]
[“ServerTasks-9911_3E54EYEKMZ”,“FIN”,“2018-07-16T18:00:25.1819462+00:00”,“Finished”,"",0]

Hi Johnny,

Thanks for getting in touch! I appreciate you bringing this to our attention, and I’m sorry about the confusion this has caused. It looks like the NowDate isn’t being formatted into DateTime correctly, which for some reason is preventing any of the variables to be substituted. This looks like a bug and I’ve logged an issue for it and you can track its progress at the following link.

I was able to work around this by formatting the DateTime as shown below (using plain text), which correctly substitutes all variables in the email.

A successful deployment of #{Octopus.Project.Name} in the #{Octopus.Environment.Name} environment on #{ | NowDate | Format DateTime "HH dd-MM-yyyy"} has occurred.

Would you be able to give that a try and let me know if that gets it working for you?

I hope this helps, and please don’t hesitate to reach out if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

Hi Kenny,

Thank you for following up with me on this. I was able to implement the workaround provided below in a plain text email with a slight modification to the time so it included the minutes. (HH:mm)

I will keep an eye out for a fix because as our process matures, we do want to use HTML formatted emails for both internal and external organizations we partner with.

Thanks again and have a great day!

Hi Johnny,

Thanks for following up and letting me know that this workaround is working well for you! That’s great to hear, and please don’t hesitate to reach out if you have any further questions in the future. :slight_smile:

Best regards,

Kenny

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