Octopus.Deployment.CreatedBy.EmailAddress empty in automatic deploy


I’ve got process setup to deploy to multiple environments. If the first succeeds, the second will be started automatically.
In this process I’ve got a an email step at the end, which I have set up to send an email to the initiator of the deploy with the variable: Octopus.Deployment.CreatedBy.EmailAddress
This works fine for the first step, but in the second step (which is started automatically on success of the first) this variable seems to be empty. I can see why that is, but it would make more sense to me if the createdby was the same as the createdby for the first deploy, as it is this first deploy that intitiates the second one.

Just to be clear, this is the error I’m getting:

The parameter ‘addresses’ cannot be an empty string.
Parameter name: addresses
System.ArgumentException: The parameter ‘addresses’ cannot be an empty string.
Parameter name: addresses
at System.Net.Mail.MailAddressCollection.Add(String addresses)
at Octopus.Server.Orchestration.Deploy.Email.EmailActionOrchestrator.CreateMessage(SmtpConfiguration smtp, DeploymentAction action, IDeploymentManifest manifest) in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\Email\EmailActionOrchestrator.cs:line 92
at Octopus.Server.Orchestration.Deploy.Email.EmailActionOrchestrator.d__0.MoveNext() in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\Email\EmailActionOrchestrator.cs:line 48
Octopus.Server version

Hi Ruben,

Thanks for reaching out. How is the 2nd deployment being triggered?

If you have the environment set to “Deploy automatically” on your lifecycle: This is as design. The automatic deployments are started by the system. You could add an Octopus variable scoped to the 2nd environment that holds the email address of the developers group and use it to set the To of the email field.

If you are you starting it using Octo.exe: The deployment would get triggered by the owner of the API Key used. So the value of Octopus.Deployment.CreatedBy.EmailAddress will be the email of the API Key owner, and she/he will get the email.

Hope that helps