Created
May 13, 2024 12:12
-
-
Save rolfschmidt/072d14623b0dfd9c9158ee1858d5c364 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prod_mode = false | |
| if ARGV[0].present? | |
| prod_mode = true | |
| puts "PROD MODE ON!!!!" | |
| sleep 3 | |
| end | |
| User.find_each do |user| | |
| begin | |
| valid = Mail::Address.new(user.email) | |
| rescue | |
| valid = false | |
| end | |
| next if valid | |
| puts "User #{user.id} (#{user.fullname}) with email '#{user.email}' is invalid" | |
| if prod_mode | |
| user.update(email: nil) | |
| puts "fixed..." | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment