putyourlightson / craft-campaign

Send and manage email campaigns, contacts and mailing lists in Craft CMS.
https://putyourlightson.com/plugins/campaign
Other
63 stars 25 forks source link

Sendout stops after failing one email with Mailersend adapter #462

Closed arifje closed 8 months ago

arifje commented 8 months ago

We switched from SendGrid to MailerSend but now sendouts are stopped completely after hitting a sending error.

This is what I found in the logs:

[2024-03-24 12:00:12] Sending batch 1 of sendout "Best posts - weekly sendout (2023)".
[2024-03-24 12:00:12] Sending of the sendout "Best posts - weekly sendout (2023)" to xxx@xxx.xxx failed after 3 send attempt(s). Please check that your Campaign email settings are correctly configured and check the error in the Craft log.

2024-03-24 12:00:12 [queue.ERROR] [yii\symfonymailer\Mailer::sendMessage] Unable to send an email: There are some warnings for your request. {"memory":79412944} 

Email settings are checked and valid. Did a test on the preview, works perfect, email received. In the Mailersend logs I see that 30-40 emails of this sendout are sent, but everything stops after hitting this error.

EDIT: could also be a bug in the Mailersend adapter, not sure though

bencroker commented 8 months ago

You’re likely hitting MailerSend’s rate limit of 120 emails per minute, see https://www.mailersend.com/help/rate-limits-how-to-reduce-403-422-429-errors#rate-limit-errors

Please refer to https://github.com/putyourlightson/craft-campaign/issues/451 for ways to resolve this and let me know if anything is unclear.

arifje commented 8 months ago

Hi Ben, thanks for the reply.

It was indeed the rate limit, but apparently they have another API endpoint for sending bulk emails: https://developers.mailersend.com/api/v1/email.html#send-bulk-emails

Is there a way to get this in the campaign plugin easily?

bencroker commented 8 months ago

You’d first need to request that feature be added to the MailerSend plugin, which is what I assume you are using as a mailer adapter. Even then, however, the campaign plugin sends one email at a time, and changing this behaviour based on the mailer adapter used is not likely to ever happen.

bencroker commented 8 months ago

FYI I created an issue at https://github.com/studioespresso/craft-mailersend/issues/2.

arifje commented 8 months ago

Thanks, that makes sense!