ankane / ahoy_email

First-party email analytics for Rails
MIT License
1.11k stars 137 forks source link

Catch (SMTP) errors when sending e-mails #137

Closed Laykou closed 4 years ago

Laykou commented 5 years ago

Hi,

while using this gem in production, I see opportunity for this gem to track also "failed" e-mails. I saw previous version captured e-mails before they were sent. Now they are being captured only when they pass through the gateway. However sometime there can be an issue e.g. with SMTP network connection or authentications...

In that case it makes sense to track the e-mail, so that we do not lose the content and mark it as "failed" with the error message. This would help us a lot to identify when e-mails are not being sent, what is the issue and resend the e-mails once the error is fixed.

Is something like this possible with this gem? Is there some configuration that we could already use or is this a new feature?

Thank you!

ankane commented 5 years ago

Hey @Laykou, that's an interesting idea. This isn't currently possibly with Ahoy Email. I feel like it's a bit out of scope for the project, but you can probably follow a similar pattern to catch errors with sending.

Laykou commented 4 years ago

++ @Mattooo

@ankane Do you have any idea how to ideally:

What do you think? We cannot be the only one needing to track emails and validate if they were sent successfully or not :)

ankane commented 4 years ago

Hey @Laykou, I imagine it's possible with interceptors and/or observers, but you'd need to look into it more. As I mentioned earlier, I think it's outside the scope of Ahoy Email.