【发布时间】:2014-06-01 11:42:38
【问题描述】:
有了这个通知器
class Notifier < ActionMailer::Base
default_url_options[:host] = "url"
def deliver_password_reset_instructions(user)
@user = user
@subject = 'Password reset instructions.'
@sent_on = Time.now
#default host is defined in development.rb configuration file
@edit_password_reset_url = url_for :controller => 'password_reset', :action => 'edit'
@edit_password_reset_url += "?id=#{user.perishable_token}"
mail to: user.email
end
end
并在 config/environments/development.rb 上使用此配置
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = {
:host => 'localhost',
:port => '3000'
}
# Options: :smtp, :test
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:user_name => 'mymail',
:password => 'mypassword',
:authentication => :plain,
:enable_starttls_auto => true }
什么都不发送,怎么回事?
【问题讨论】:
标签: ruby-on-rails actionmailer