# How can I automatically confirm a secondary email address?

**URL:** <https://meta.discourse.org/t/how-can-i-automatically-confirm-a-secondary-email-address/300354>\
**Category:** Product Support\
**Created:** [March 21, 2024, 1:25pm UTC](https://meta.discourse.org/t/how-can-i-automatically-confirm-a-secondary-email-address/300354 "2024-03-21T13:25:41Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)\
**Post date:** [March 26, 2024, 5:25pm UTC](https://meta.discourse.org/t/how-can-i-automatically-confirm-a-secondary-email-address/300354/9 "2024-03-26T17:25:52Z")

</div>

This is not a direct answer to your question, but: In the case of mass-renaming of email-addresses, you could do it via rails console:

```ruby
o = "@old_company.com" 
n = "@new_company.com"
UserEmail.where("email LIKE ?","%#{o}").each do |ue| 
  ue.email.sub! o,n 
  ue.save! 
end

```

If you favor adding a secondary email address:

```ruby
o = "@old_company.com" 
n = "@new_company.com"

UserEmail.where("email LIKE ?","%#{o}").each do |ue|
   sm = UserEmail.new
   sm.user_id = ue.id
   sm.email = ue.email.sub! o,n
   sm.save!
end

```

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-automatically-confirm-a-secondary-email-address/300354)._
