ruby 2.1 - Mail gets send from smtp username setting not from "from" method in ActionMailer rails -
in user_mailer.rb
class usermailer < actionmailer::base default from: "email.1@gmail.com" 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.2@gmail.com", password: env["gmail_password"] }
i email "email.2@gmail.com" why not "email.1@gmail.com", waiting clarification guys.
in smtp_settings
, need set user_name
, password
if our mail server requires authentication.
in case have provided authentication 'email.2@gmail.com'
in development.rb file. hence action mailer ignore default from: "email.1@gmail.com"
cannot authenticate it.
Comments
Post a Comment