email - How do I configure a "From" address in my Rails 5 mailer? -
i'm trying create email rails 5 app , want set "from:" address per environment. have created config/initializers/mailer_config.rb whit content
if defined?(rails) case rails.env when "production" rails_from_email = "no-reply@me.no-ip.com" when "test" rails_from_email = "no-reply@me.no-ip.com" when "development" rails_from_email = "no-reply@me.no-ip.com" end end here mailer class, app/mailers/user_notifier.rb
class usernotifier < actionmailer::base default :from => '#{rails_from_email}' ... end but when go test out mailer, address doesn't seem getting picked up. appears as
from: #{rails_from_email} what else need configure "from" address recognized?
default :from => '#{rails_from_email}' is not correct, rails_from_email variable can call this.
default :from => rails_from_email or better
default from: rails_from_email also if want call variable in string have above need " instead of ', "#{rails_from_email}". don't ever need 1 variable.
Comments
Post a Comment