Open MrMarci666 opened 4 months ago
Hey @MrMarci666, apologies for getting on to this one so late.
I believe this could be caused by versions of the library prior to PR #58 or prior to v0.12.0
. The underlying mailing system of Laravel depends on the TransportException
type to "failover" to the next mailer.
If you upgrade to the latest version, this should be fixed. Let me know how it goes.
@jayanratna Thanks for the reply. Sounds good! :) Yes, I can confirm we were using v0.11.0 at the time, so that was solved.
But the main issue still remains I assume... That the package is basically ignoring a very core function of the API, the rate limitation.
That is something I am currently investigating. I'm wondering what the best way to expose the rate limit information would be.
Currently there is a functionality to expose the ID of the sent email with the X-Resend-Email-ID
, perhaps it could be done the same way. Though that header is only available on successful requests 🤔
I see, cool. Hmmm let me summon also @floodx92. (We faced this issue in a project together) What do you think @floodx92, what would be the best solution to this?
I'm having this same problem and I'm using version 0.14.0. Is there a solution yet?
I have a soluction for now.
1 create a job to send every emails and when call then define delay:
SendEmailJob::dispatch($event)->delay(now()->addSeconds(3))->onQueue('send_emails');
public function handle()
{
try {
Mail::to($this->recipient)->send(new SendNewsletter($this->data));
} catch (TransportException $e) {
if (str_contains($e->getMessage(), 'Too many requests')) {
// Handle the specific "Too many requests" exception
$this->release(10); // Delay the job for 10 seconds before retrying
} else {
// Rethrow the exception if it's not related to rate limiting
throw $e;
}
}
}
Intro
Hello there,
We experienced many issues with this package, because it is simply ignoring the rate limitation of Resend.
We are using a "Failover" configuration in Laravel 11.
Expected behaviour
I expect when I want to send out E-Mails using Resend mail driver in Laravel, it should work. If Resend has a built-in 2 requests per second rate limit, and also rate limit information response headers, the package should be prepared to read and use this information, and send out the mails via Resend correctly.
Also, if the requests fails, Laravel should use the next E-Mail sending method configured in the
failover
configuration. I am not sure that this is a Laravel issue or a Resend package issue, but it doesn't work right now, if the response is 429 from Resend, Laravel won't try to send out with the next configured E-Mail sender.Issue description, screenshots
So we just released a webshop with around 15.000 users and wanted to send them a Password Change E-Mail. However, this resulted with a disaster that the Resend API responded with 429 in many cases, and Laravel didn't try to send it out with the failover SMTP server, it just threw an error... 👎