Felix
Felix

Reputation: 5629

Ruby on Rails app fetch bounces How to?

is there any possibility to check with the ActionMailer mail function if a mail-address is still alive?

My problem is that I have a ruby on rails application with lots of users, but some of those changed their mail address and now I got lots of mails back. It would be cool If I can check if the mail is still present, and if not I delete the user from Database.

Any Ideas for this problem?

Upvotes: 0

Views: 38

Answers (1)

Anthony
Anthony

Reputation: 15977

If you're sending mail and it fails, you can view those if you've configured

raise_delivery_errors = true

That would go in your config/environment/development or production.rb

Sadly though, with raise_delivery_errors there's a gotcha:

This only works if the external email server is configured for immediate delivery.

If you have the option to use something like mailchimp, sendgrid, etc it handles most of this for you - it won't send to bogus emails, it silences them on future mailings and is just a convenient way to manage your email clickthroughs, etc. Some email services give you a webhook that says "this email bounced" which you can then do something with in your app/database. Or more primitively, you can download a csv periodically from their portal and update the database.

Upvotes: 1

Related Questions