Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Email - send via Hangfire job, MailKit fails after approx 20 mails #10649


User avatar
0
deltavision created

Hi,

  • 9.0.1, MVC, .NET CORE

A Hangfire job sends out mails to users. With about 100 mails to be send - system fails, after approx 20 mails.

I suppose it is our SMTP provider, that returns the error - but how can we avoid this? Is it possible to close the connection between sending each email? And would this solve the issue?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @deltavision

    If you want to send all emails, I think you should wait N seconds when you first get and error and 2 x N for each following error to send the next email. When the send is successfully, you can reset this wait amount and send all emails until you get a next error.

  • User Avatar
    1
    deltavision created

    Hi @ismcagdas

    handled as suggested with at try/catch - and wait, retry. Not a "nice" solution, but it works.