How to config devise gem to send email to the resource?

こ雲淡風輕ζ 提交于 2019-12-22 18:26:58

问题


I am using devise gem not what should i configure to send emails to the registered user ?

i have saw some links but did not understand .please help me


回答1:


# ActionMailer Config in development/production rb file
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
# change to true to allow email to be sent during development
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "mail.google.com",####important
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: ENV["GMAIL_USERNAME"],
  password: ENV["GMAIL_PASSWORD"]
}

and

config/initializers/devise.rb

config.mailer_sender = 'email@example.com'


来源:https://stackoverflow.com/questions/21610815/how-to-config-devise-gem-to-send-email-to-the-resource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!