Email step failing without useful error

Configured/tested SMTP and it is successful.

Email step in deployment fails and just gives the following error message:

2013-04-09 13:09:41 DEBUG The email subject is: 12.0.142.0 deployed to Dev
2013-04-09 13:09:41 DEBUG Sending email message…

Event viewer shows:

2013-04-09 07:09:56,728 [54] ERROR Octopus [(null)] - System.AggregateException: One or more errors occurred. —> System.Net.Mail.SmtpException: Failure sending mail. —> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.Mail.Message.BeginSend(BaseWriter writer, Boolean sendEnvelope, AsyncCallback callback, Object state)
at System.Net.Mail.SmtpClient.SendMailCallback(IAsyncResult result)
— End of inner exception stack trace —

Server stack trace:

Exception rethrown at [0]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.SendEmailActivity.d__0.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\SendEmailActivity.cs:line 44

Exception rethrown at [1]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56

Exception rethrown at [2]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.InstallationActivity.d__a.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\InstallationActivity.cs:line 58

Exception rethrown at [3]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56

Exception rethrown at [4]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.DeploymentControllerActivity.d__3.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\DeploymentControllerActivity.cs:line 58

Exception rethrown at [5]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56
— End of inner exception stack trace —
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Octopus.Shared.Activities.ActivityState.WaitForComplete() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityState.cs:line 91
at Octopus.Server.Tasks.TaskRunner.Execute(Task task) in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\TaskRunner.cs:line 71
—> (Inner Exception #0) System.Net.Mail.SmtpException: Failure sending mail. —> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.Mail.Message.BeginSend(BaseWriter writer, Boolean sendEnvelope, AsyncCallback callback, Object state)
at System.Net.Mail.SmtpClient.SendMailCallback(IAsyncResult result)
— End of inner exception stack trace —

Server stack trace:

Exception rethrown at [0]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.SendEmailActivity.d__0.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\SendEmailActivity.cs:line 44

Exception rethrown at [1]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56

Exception rethrown at [2]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.InstallationActivity.d__a.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\InstallationActivity.cs:line 58

Exception rethrown at [3]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56

Exception rethrown at [4]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Server.Tasks.Deploy.DeploymentControllerActivity.d__3.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Server\Tasks\Deploy\DeploymentControllerActivity.cs:line 58

Exception rethrown at [5]:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Octopus.Shared.Activities.ActivityRuntime.d__5.MoveNext() in c:\w\e6923628be6eaf72\source\Octopus.Shared\Activities\ActivityRuntime.cs:line 56<—

Hi Jack,

Thanks. I agree it’s not a useful error. Could you send me a screenshot of your email step definition?

Paul

Here is the screenshot.

Setting up and testing SMTP is successful under the “Configuration” page.

Hi Jack,

Is it possible the “to” address is an invalid email address? That’s the only way I’ve been able to reproduce this bug so far.

Paul

Weird. Our Exchange server supports multiple domains, but sending to one of them fails. I have all the email addresses on the one domain now, and it works.

We encounter this error on and off. First deployment it fails, retry and it works. Same e-mail list. Only the above mentioned exceptions seems to hit the event log. Any news about this bug?

Worked for me
Jack Unrau’s Avatar

Weird. Our Exchange server supports multiple domains, but sending to one of them fails. I have all the email addresses on the one domain now, and it works.