Send Mail Activity Failing using Azure Communication Services
Hi everyone,
We've set up VertiGIS Studio applications on an Azure server and IT utilized Azure Communications Service to create a cloud-based SMTP connection so that I could utilize the Send Mail activity in some workflows.
I updated the emailsettings.json, recycled the application pool, and tested the workflow in the sandbox, and I'm receiving the following error stack trace:
"traces": [ "Error: 0: Unexpected Error: VertiGIS.Workflow.Runtime.Execution.Exceptions.ActivityExecutionException: [WF: Activity execution error] Failed to execute activity 12 with action gcx:wf:server::SendEmail: An error occurred while attempting to establish an SSL or TLS connection.", "When connecting to an SMTP service, port 587 is typically reserved for plain-text connections. If", "you intended to connect to SMTP on the SSL port, try connecting to port 465 instead. Otherwise,", "if you intended to use STARTTLS, make sure to use the following code:", "client.Connect (\"smtp.azurecomm.net\", 587, SecureSocketOptions.StartTls);", " ---> MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.", "When connecting to an SMTP service, port 587 is typically reserved for plain-text connections. If", "you intended to connect to SMTP on the SSL port, try connecting to port 465 instead. Otherwise,", "if you intended to use STARTTLS, make sure to use the following code:", "client.Connect (\"smtp.azurecomm.net\", 587, SecureSocketOptions.StartTls);", " ---> System.Security.Authentication.AuthenticationException: Cannot determine the frame size or a corrupted frame was received.", " at System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan`1 buffer)", " at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize)", " at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)", " at System.Net.Security.SslStream.ReceiveHandshakeFrameAsync[TIOAdapter](CancellationToken cancellationToken)", " at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)", " at MailKit.Net.Smtp.SmtpClient.SslHandshakeAsync(SslStream ssl, String host, CancellationToken cancellationToken)", " at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)", " --- End of inner exception stack trace ---", " at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)", " at VertiGIS.Workflow.Server.Activities.SendEmail.Execute(IDictionary`2 inputs, IActivityContext context)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)", " --- End of inner exception stack trace ---", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteFinish(IActivityHandler handler, IDictionary`2 inputs)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteStart()", " at VertiGIS.Workflow.Runtime.Execution.AmbientState.ExecuteCurrentContext()", " at VertiGIS.Workflow.Runtime.Execution.AmbientState.Execute()", " at VertiGIS.Workflow.Runtime.Execution.Engine.Run(Program program, RunOptions options)", " at VertiGIS.Workflow.Hosts.Server.Host.RunWorkflow(String workflowJson, IDictionary`2 inputs, IDictionary`2 trivia, String accessToken, String portalUrl, CancellationToken cancellationToken)", " at VertiGIS.Workflow.Server.Foundation.WorkflowRunner.ProcessAsync(Object content)" ]
IT provided me with the username, password, port (587, so EnableSSL is set to true), and the host, so that I could update emailsettings.json. These don't seem to be working and I'm wondering if anyone else has encountered this, or does this error possibly point to something IT needs to handle? Thanks!
- Jack C.
-
Hey Jack Charde if you read into the error, it notes that 587 is typically used for plain text, not encrypted. It also notes that port 465 is what you want for SSL.
1 -
Hey Gareth,
I did try a number of alterations before posting this (I should have mentioned that). I changed emailsettings.json to use 465 with “EnableSSL” set to both true and false, and neither worked.
When I use port 465, and EnableSSL: true, I get the following error:
"traces": [ "Error: 0: Unexpected Error: VertiGIS.Workflow.Runtime.Execution.Exceptions.ActivityExecutionException: [WF: Activity execution error] Failed to execute activity 12 with action gcx:wf:server::SendEmail: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.", " ---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.", " at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)", " at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)", " at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)", "--- End of stack trace from previous location ---", " at System.Threading.Tasks.TaskToAsyncResult.End(IAsyncResult asyncResult)", " at MailKit.Net.SocketUtils.SocketConnectState.OnEndConnect(IAsyncResult ar)", "--- End of stack trace from previous location ---", " at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, CancellationToken cancellationToken)", " at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, CancellationToken cancellationToken)", " at MailKit.MailService.ConnectNetworkAsync(String host, Int32 port, CancellationToken cancellationToken)", " at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)", " at VertiGIS.Workflow.Server.Activities.SendEmail.Execute(IDictionary`2 inputs, IActivityContext context)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)", " --- End of inner exception stack trace ---", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteFinish(IActivityHandler handler, IDictionary`2 inputs)", " at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteStart()", " at VertiGIS.Workflow.Runtime.Execution.AmbientState.ExecuteCurrentContext()", " at VertiGIS.Workflow.Runtime.Execution.AmbientState.Execute()", " at VertiGIS.Workflow.Runtime.Execution.Engine.Run(Program program, RunOptions options)", " at VertiGIS.Workflow.Hosts.Server.Host.RunWorkflow(String workflowJson, IDictionary`2 inputs, IDictionary`2 trivia, String accessToken, String portalUrl, CancellationToken cancellationToken)", " at VertiGIS.Workflow.Server.Foundation.WorkflowRunner.ProcessAsync(Object content)" ]0 -
IT just told me that Azure Communication Services does not support port 465, but they do support port 25 with TLS and SMTP Authentication. I tried that port with EnableSSL: false, and it worked! Also, now 587 is working with EnableSSL: false. Not sure why it didn't work when I tried earlier, but it's good to go now.
1 -
Aha, glad you found success!
0
Please sign in to leave a comment.
Comments
4 comments