office365-mail icon indicating copy to clipboard operation
office365-mail copied to clipboard

Rate limiting / throttling

Open beard7 opened this issue 2 years ago • 2 comments

Is there a way to implement rate limiting / throttling on the number of mails sent per second? The Symphony AbstractTransport class has a setMaxPerSecond method which sets a rate public property, but I don't think that would have any impact here.

I'm running into a problem where emails are failing with: 503 Service Unavailable response: {"error": {"code":"ResourceUnhealthy","message":"MdbReplicationProtectionUtilizationMonitor is unhealthy."} }

I've contacted Microsoft support and they tell me this is due to sending too many requests, essentially the same as a 429 error.

Microsoft provides some info on how to handle this here: Best Practices essentially using the Retry-After header, but I don't know if this is something that can be implemented with this mail driver.

Any advice is much appreciated.

beard7 avatar Jan 25 '23 08:01 beard7

Maybe you can prevent this by using schedules?

motze92 avatar May 16 '23 15:05 motze92

Thanks. I'd forgotten about this issue. It's easily solved by using Laravel's built in queue throttling options.

beard7 avatar May 16 '23 15:05 beard7