Send Email connector in logic App fails to send email due to asynchronous call issue

Mohamed Sahbi 51 Reputation points
2023-04-03T12:23:48.13+00:00

Hi,

I have a logic app Standard with multiple workflows to send emails.

When I trigger a workflow multiple times, it ran into this issue:

{"statusCode":"NotFound","body":{"code":"ServiceProviderActionFailed","message":"The service provider action failed with error code 'ServiceOperationInvalidParameter' and error message 'The specified SMTP Server Address cannot be found: 'my.smtp.server''."}}

When going through the Application Insights log, I found the real issue:

Error message: correlationId='8dcf88bf-5f21-407f-8383-2c94b868572f', operationName='Smtp.sendEmail', message='Server Address: my.smtp.server. Failure sending mail. ', exception='System.InvalidOperationException: An asynchronous call is already in progress. It must be completed or canceled before you can call this method.
   at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken)', organizationId='', activityVector='IN.03', additionalProperties='{"ParentActivityId":"00-66fe8c4f8c7e14411a77c94b1d311928-41ab5df102fe54e8-00"}', extensionVersion='1.8.9.0', siteName='logic-d-app-10007742', slotName='Production', activityId='3b310479-b1d3-4d13-b797-089cee92cfe9'.

Is there a way to fix this?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,551 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Mohamed Sahbi 51 Reputation points
    2023-04-06T14:04:26.1533333+00:00

    I solved the problem with the help of Microsoft Support by doing the following:

    1. Set concurrency control to 1 in the HTTP Request Trigger User's image
    2. As I have multiple workflows that send emails, the first step is not enough to solve the throttling problem. So, I had to create a new shared workflow to send emails and trigger this workflow from the existing workflows by using the action "Invoke a workflow in this workflow app"
    1 person found this answer helpful.
    0 comments No comments

  2. Andy David - MVP 157.8K Reputation points MVP Volunteer Moderator
    2023-04-03T12:38:57.54+00:00

  3. MayankBargali-MSFT 70,941 Reputation points Moderator
    2023-04-04T17:27:24.0566667+00:00

    @Mohamed Sahbi Thanks for reaching out. There are some throttling limits at the office end as documented here and you may be hitting the sending limits. I will suggest you to change the default retry policy configure of you Send email (v2) action and configure the Exponential Interval retry so it could help you on your case when you are sending a large number of requests. In case if it doesn't help then I will suggest you to engage us over one on one support so we can review the backend logs to know the root cause of the issue and suggest you the next course of action. In case if you don't have the support plan then please let me know.

    Feel free to get back to me if you have any queries or concerns.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.