我是通過導軌發送郵件的新手。我在我的項目中實施了設計,現在我想發送一封歡迎電子郵件和/或密碼重置電子郵件。 Devise視圖需要做什麼修改? 沒有顯示錯誤,但我仍然沒有收到任何電子郵件。Rails設計發送郵件
我按照這些鏈接,最後我的devise.rb,development.rb和production.rb文件如下:
=== devise.rb ===
config.mailer_sender = "[email protected]"
== = development.rb ==
config.action_mailer.raise_delivery_errors = false
config.action_dispatch.best_standards_support = :builtin
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.active_support.deprecation = :log
config.action_mailer.smtp_settings ={
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:tls => true,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => '[email protected]',
:password => 'xxxxxx'
}
=====production.rb===
config.action_mailer.default_url_options = { :host => 'gmail.com' }
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors =false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:tls => true,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => '[email protected]',
:password => 'xxxxxx'
}
日Thnx ...我意識到我必須設置「perform_deliveries」無需寶石tlsmail工作true..its .. – Shruti