I'm trying to send an email to myself every time any user creates and saves a new record. I currently have this in the part of my controller that saves new records:
UserMailer.notification_email().deliver
And this in my user mailer:
class UserMailer < ActionMailer::Base
default from: "from@example.com"
def notification_email()
mail(:to => "admin@example.co.uk",
:subject => "Test")
end
end
I'm aware it should probably pass some parameters I'm just not sure what, plus all the examples I can find send out emails to each user rather than a static email address.
Have you set smtp settings in environment? Something like this:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
# your settings
}