Ruby on rails Action Mailer确认电子邮件-Ruby on Rails
我已经成功地安装了来自ThoughtBot的。许可在新注册时发送确认电子邮件,并建议添加:Ruby on rails Action Mailer确认电子邮件-Ruby on Rails,ruby-on-rails,ruby,email,actionmailer,Ruby On Rails,Ruby,Email,Actionmailer,我已经成功地安装了来自ThoughtBot的。许可在新注册时发送确认电子邮件,并建议添加: config.action_mailer.default_url_options = { :host => 'localhost:3000' } 到您的/environments/test.rb和development.rb。我试过这个,也试过 config.action_mailer.default_url_options = { :host => '127.0.0.1', :port =
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
到您的/environments/test.rb和development.rb。我试过这个,也试过
config.action_mailer.default_url_options = { :host => '127.0.0.1', :port => 3000 }
但似乎无法让rails发送电子邮件。由于我对Ruby和Rails都是新手,我想知道ThoughtBot是否假设我已经完成了发送电子邮件的步骤/配置
我做错了什么/错过了什么
更新:
刚刚添加了notifier.rb
class Notifier < ActionMailer::Base
def signup_notification(recipient)
recipients recipient.email_address_with_name
bcc ["example@gmail.com"]
from "example@example.com"
subject "New account information"
body :account => recipient
end
end
类通知程序我必须生成用户邮件模型
script/generate mailer UserMailer
您是否忘记粘贴通知程序中的一些行?没有函数声明。我只是使用以下代码:您忘记了
def signup\u notification(recipient)
lineAh,只是添加了它,但仍然无法执行。也许我需要一个“to”行?到“user.email”?