-
-
Notifications
You must be signed in to change notification settings - Fork 34
Rescue Mail::AddressList parse errors #34
Conversation
Interesting... I'm no longer at the company where I was using this gem, so I haven't run into this problem.
Also assuming that spec is representative, it looks suspiciously like that last character got lopped off somewhere along the way. |
If a malformed email address makes it's way to normalize_params it currently explodes resulting in a 500 which Sendgrid retries. If a few of these come in per day the resulting errors snowball pretty quickly. The email will never properly parse, of course so retrying is futile.
17fd093
to
5020650
Compare
Hi @sdhull, thanks for taking a look.
This missing closing bracket in the specs is intentional and representational of the data being sent to us from Sendgrid. I did update the spec to have the malformed address to be in the Overall, definitely not the end of the world, as I said above, we've been using this gem for years without issue, but if a few emails slip through and get into this failure loop it can get really noisy for a few days while Sendgrid keeps retrying them. |
Ohhh right I forgot this was a Rails Engine. Hmmm 🤔 Checked out the def self.extract_email_address(full_address)
full_address.split('<').last.delete('>').strip
end I think that would work? I'm a bit concerned about silently swallowing errors because if you imagine an important email that should have been processed and it just disappears, not in your error reporting, not in your list of processed messages, how do you even debug that? Maybe add an optional error handler? |
@sdhull yeah, definitely don't want things disappearing without notices. However, the current situation prevents the incoming message from being processed at all. With this solution it'll at least process and show up in the Perhaps a |
Ohhh yeah good point. Sorry I totally forgot how this library works 😂 someone else should probably be in charge of merging PRs at this point 😞 OK well your explanation makes perfect sense & is a totally reasonable way to deal with these cases. I think we should merge this. No one else has chimed in and it's been two weeks so I'm gonna merge it. If someone else wants to change it they can submit a PR to do so |
@AnthonyClark I checked my access on Rubygems and unfortunately I don't have rights to publish a new version. Looking through commit history, it looks like maybe @wingrunr21 can publish? |
Yep, I’ll cut a release today |
Released as |
Thank you @wingrunr21 ! 😃 |
Yep! BTW I don’t use this gem. I just inherited maintenance and such on it. If you or someone else is interested then happy to talk! |
@wingrunr21 and @sdhull thanks for the version bump and continued maintenance. This gem has always Just Worked:tm: for us so it's been great. It looks like similar functionality is going to be part of Rails 6 as ActionMailbox out of the box, so I assume usage of this gem is going to start declining. I haven't tried it out yet, but if it's basically a drop-in replacement I'd assume we and others will gravitate toward the "rails way". It'll be interesting to see what the griddler project as a whole decides to do going forward. |
If a malformed email address makes it's way to
normalize_params
it currently explodes resulting in a 500 which Sendgrid retries for 72 hours. If a few of these come in per day the resulting errors snowball pretty quickly. The email will never properly parse, of course, so retrying is futile.We've been using
griddler-sendgrid
for quite a few years now and for whatever reason we've been getting inundated with these the last week or so, had not seen it before! Maybe something changed at Sendgrid? In either case we think this is probably the right behavior,charsets
method does the same.