Skip to content

Instantly share code, notes, and snippets.

@rolfschmidt
Created May 13, 2024 12:12
Show Gist options
  • Select an option

  • Save rolfschmidt/072d14623b0dfd9c9158ee1858d5c364 to your computer and use it in GitHub Desktop.

Select an option

Save rolfschmidt/072d14623b0dfd9c9158ee1858d5c364 to your computer and use it in GitHub Desktop.
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