1

Ok, here is my question. Is it possible to send the custom email to a static email address using the devise. Here is my devise.rb:

config.mailer = "MyMailer"

Here is my my_mailer.rb:

 class MyMailer < Devise::Mailer

   default from: "email@example.com"


   def welcome_email

    mail(:to => 'myemail@hotmail.com', :subject => "New user!")
   end



 end

and here is my welcome_email.html.rb in views/my_mailer:

 <h1>New user just signed up! </h1>

I need this email to be sent to me at the same time when the devise sends confirmation instructions to the new user.

Admir Huric
  • 137
  • 8

1 Answers1

1

You can use make your own custom mailer:

https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer

Alternatively, you can define headers_for method in your devise resource:

def headers_for(action)
  {:bcc => 'email@example.com'}
end

Here's where you can get more info about headers_for:

rails 3 + devise: how to modify the mailer method for confirmation emails to add user's second email address

Community
  • 1
  • 1
Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56