question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An asynchronous call is already in progress

See original GitHub issue

SMTP it’s not implemented properly probably. I cannot send two messages simultaneously.

 Unexpected Server 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)
   at FluentEmail.Smtp.SendMailEx.SendMailExImplAsync(SmtpClient client, MailMessage message, CancellationToken token)
   at FluentEmail.Smtp.SmtpSender.SendAsync(IFluentEmail email, Nullable`1 token)
   at FluentEmail.Core.Email.SendAsync(Nullable`1 token)

Take a look here: https://stackoverflow.com/questions/50036795/getting-error-while-sending-bulk-email-an-asynchronous-call-is-already-in-progr

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
Yukoncommented, Feb 3, 2020

I have found the cause of the issue to be the SmtpClient is reused throughout the entire lifetime of the application. A fix can be made in applications without pulling my patch by explicitly using the function version of AddSmtpSender. For example AddSmtpSender(() => new SmtpClient("smtp.example.com", 25)) instead of AddSmtpSender("smtp.example.com", 25).

1reaction
NickVandenberghecommented, May 14, 2020

For example AddSmtpSender(() => new SmtpClient(“smtp.example.com”, 25)) instead of AddSmtpSender(“smtp.example.com”, 25).

I already fixed this now. I configured a smtpclient before adding it to the AddSmtpSender function I fixed my error by configuring the smtpclient in the AddSmtpSender function

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error while sending bulk email "An asynchronous ...
Getting error while sending bulk email "An asynchronous call is already in progress. It must be completed or canceled before you can call...
Read more >
C# – Why do we periodically get “An asynchronous call is ...
C# – Why do we periodically get “An asynchronous call is already in progress” when calling SmtpClient.Send .netc++smtpclient. We have some (synchronous) ...
Read more >
Solved: An asynchronous call is already in progress error ...
Hi EE, I am trying to resolve a problem we're experiencing with the 'An asynchronous call is already in progress.' error when sending...
Read more >
Send Email connector in logic App fails to send email due ...
InvalidOperationException: An asynchronous call is already in progress. It must be completed or canceled before you can call this method. at ...
Read more >
Getting error while sending bulk email "An asynchronous call ...
[Solved]-Getting error while sending bulk email "An asynchronous call is already in progress. It must be completed or canceled before you can call...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found