inside controller:
def update
@user.update({approved: true})
UserMailer.send_approved_mail(@user)
redirect_to(root_url)
end
inside user_mailer.rb
class UserMailer < Devise::Mailer
def send_approved_mail(user)
@resource = user
email_body = render "user_activated_mail"
if @resource.valid?
client = Postmark::ApiClient.new(ENV["POSTMARK_API_KEY"])
client.deliver(from: ENV["POSTMARK_SIGNATURE"],
to: @resource.email, subject: "User Activation information.",
tag: 'account-activated', :content_type => "text/html",
html_body: email_body)
end
end
end
In rails 4.1.0 above method in controller is being called and email is being sent, but in rails 4.2 the mailer method in controller is not being called, but when called from rails console it works. I have made all the necessary configuration for postmark api and in configuration files. The only thing is in rails 4.1.0 mailer inside controller gets called but in rails 4.2 it doesn't but works when called from rails console. What is the exact reason really can't figure it out.