# 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:** 13

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [March 27, 2024, 2:14pm UTC](https://meta.discourse.org/t/how-can-i-automatically-confirm-a-secondary-email-address/300354/13 "2024-03-27T14:14:02Z")

</div>

Hmmm. 🤔 I think I was maybe working on the assumption that the move to the new IDP would have mapped them across based on an external id of some sort.

> [@Tris20](#):
>
> I wonder if this still has the same issue in terms of confirmation, or are they assumed to be confirmed?

I think it is possible to activate/confirm the email through the rails console by adding in the token info too. Something like:

```ruby
old_domain = "<insert_here_the_old_domain>"
new_domain = "<insert_here_the_new_domain>"

users = UserEmail.where("email like '%" + old_domain + "'")

users.each do |user_email|
    user = User.find_by_id(user_email.user_id)
    user.email = user.email.gsub(old_domain, new_domain)
    user.email_tokens.create(email: user.email)
    user.activate
    user.save!
    puts "."
end

```

---

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