i'm new on ruby on rails, i want to send two emails when a user create a account in my project, so, when the user sends a request inserting email and password, i want to send email confirmable for your email and send a message informing the request of a user for my email. How do i resolve this problem? Thanks.
Create a callback.
Model
class User < ActiveRecord::Base
after_create :send_admin_mail
...
def send_admin_mail
AdminMailer.new_user(self)
end
end
Mailer
class AdminMailer < ActionMailer::Base
def new_user(user)
@user = user
mail(subject: 'A new user has signed up!!111')
end
end
You'll have to adjust the mailer settings (ie: default to:
should be the people you want notified of new user sign ups.
More info available at
[1]: Action Mailer Basics