Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6001393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:49:41+00:00 2026-05-23T00:49:41+00:00

Background: In our app, we often have a sales rep do the setup for

  • 0

Background: In our app, we often have a sales rep do the setup for our customer using the salesperson’s computer (often customers don’t have access to their email at the time we set them up). So we’re thinking to add a field to the devise registration form for the sales rep’s email address and have the confirm link ALSO go to that email address.

Question: Is there a way to tell devise to bcc (or cc) the initial confirmation email (only the initial confirmation email) to an (optional) “backup_email” email address that is also provided on the new user registration form?

Alternatively, is there a way to ‘disable’ the confirmation email process but ONLY when a certain code is entered into the registration field?

I know how to add another field to the devise registration form, but I don’t see how/where to modify the devise mailer code so when a confirmation email is sent to the “email” address it ALSO goes to the “backup_email” address (if any, sometimes it’s blank).


Thanks to Johnny Grass!

I did rails generate mailer CustomerUserMailer
and added

#config/initializers/devise.rb
config.mailer = "CustomUserMailer"

my custom mailer looks like:

# app/mailers/customer_user_mailer.rb
class CustomUserMailer < Devise::Mailer
  def headers_for(action)
    headers = {
      :subject       => translate(devise_mapping, action),
      :from          => mailer_sender(devise_mapping),
      :to            => resource.email,
      :cc            => resource.backup_user_email(action),
      :template_path => template_paths
    }
  end
end

Then I moved the 3 mailer templates FROM views/devise/mailer to views/customer_user_mailer (otherwise the emails are empty)

Then I added a method to my User model called backup_user_email() that returns the ‘backup’ email address (if any) based on the data in the user record and the action. The only “trick” there is that when testing the action it is not action == "confirmation_instructions" it is action == :confirmation_instructions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:49:41+00:00Added an answer on May 23, 2026 at 12:49 am

    One way to do it would be to override the headers_for action in Devise::Mailer

    class MyMailer < Devise::Mailer
      backup_email = "..."
      def headers_for(action)
        headers = {
         :subject       => translate(devise_mapping, action),
         :from          => mailer_sender(devise_mapping),
         :to            => resource.email,
         :bcc           => backup_email
         :template_path => template_paths
      }
    end
    

    And tell devise to use your mailer:

    #config/initializers/devise.rb
    config.mailer = "MyMailer"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: we have a Grails 1.3.7 app and are using Liquibase to manage our
Background: We have a TFS server setup where me manage our source code and
Background A customer is running our web app. over HTTPS and are running into
Background: Our web app uses the jquery.constrain.js plugin to handle data entry in some
We have an application that downloads some files in the background. Our application pops
Background: I have a little video playing app with a UI inspired by the
Background: Our app is a fairly straight forward MVC web app that calls a
Have another issue here. Our app starts out with a tab activity. But, before
We have/had a phantom delay in our app. This was traced to the initialisation
We are using SVG in our web app and we need to allow users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.