In user_mailer.rb
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def approved_mail(user)
@user = user
@greeting = "Hi"
mail to: @user.email
end
end
And in development.rb
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "gmail.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: "[email protected]",
password: ENV["GMAIL_PASSWORD"]
}
I get email from "[email protected]" why not from "[email protected]", waiting for clarification guys.
In the
smtp_settings
, we need to set theuser_name
andpassword
if our mail server requires authentication.In your case you have provided the authentication for
'[email protected]'
in development.rb file. Hence action mailer will ignoredefault from: "[email protected]"
as it cannot authenticate it.