pentacent / keila

Open Source Newsletter Tool.
https://keila.io
GNU Affero General Public License v3.0
1.25k stars 61 forks source link

Stops sending emails with no error #223

Closed auntphil closed 11 months ago

auntphil commented 11 months ago

I use MailGun as my email sender. I have tried both the API and SMTP option with MailGun. I have tried lowering the rate limit to 2 per second.

When I send a campaign of 111 contacts only 26 are sent. There are no error messages in the docker logs.

Is there a more verbose log?

wmnnd commented 11 months ago

Do you have any visibility on what MailGun is receiving? Is it possible that MailGun rejected the mails coming from your instance? You could also look for failed jobs in the oban_jobs table.

auntphil commented 11 months ago

MailGun does keep logs of mail, but it only show the 26 emails being accepted and then being delivered. It does not show rejected API calls or at least not that I can find. The oban_jobs table shows no errors and indicates all jobs have a status of complete

wmnnd commented 11 months ago

Could you also check the mailings_recipients table? It should contain a row for each campaign recipient and receipt column if it was delivered successfully. If the delivery failed, you should see the failed_at columns set.

The logging of failed emails only happens via Logger.debug/1, so it won’t be included in your logs. I will change this to Logger.warning/1 in the next release.

wmnnd commented 11 months ago

@auntphil I’ve just released 0.12.3 which changes the logging mode of this error. Could you try sending your campaign again with this version and see what happens?

auntphil commented 11 months ago

@wmnnd First off, thank you for all of your help. I believe I have found the issue, it appears I was being rate limited by MailGun. After I did some verification with them I can send large batches. However, more logging will be helpful in the future since I had no indication of the rate limit from the API.

I loaded up the latest version with my config but the Keila container does load. I get this specific error: (UndefinedFunctionError) function KeilaWeb.captcha/0 is undefined or private

wmnnd commented 11 months ago

Oh, thanks for noticing! Since this was a bug in the production runtime config, it didn’t show in testing :see_no_evil: Is it working now with 0.12.4?

auntphil commented 11 months ago

Can confirm 0.12.4 fixed the issue with the undefined or private function. I also tested a 199 contact list and they all sent successfully. Looks like my original issue was unrelated to Keila, but unfortunately I didn't have logs about the API being rate limited. Just out of curiosity, should I have seen more information in the docker logs as it was sending? It appeared to be the same information.

Thanks again for your quick help.

wmnnd commented 11 months ago

Great to hear everything seems to be working now! Since everything was sending correctly, you should not have seen more logs this time. But if an error happens again in the future, you’ll see it in the logs.