当我点击我的确认电子邮件中的链接时,它似乎指向了我的应用程序无法识别的路径。
url看起来像这样:
http://glowing-flower-855.heroku.com/users/confirmation?confirmation_token=lIUuOINyxfTW3TBPPI
这看起来是正确的,但它似乎转到了我的500.html文件。
它与我的用户模型中覆盖Devise的confirm!
方法的代码有关:
def confirm!
UserMailer.welcome_message(self).deliver
super
end
根据我的日志,这是错误:
2011-06-10T03:48:11+00:00 app[web.1]: ArgumentError (A sender (Return-Path, Sender or From) required to send a message):
2011-06-10T03:48:11+00:00 app[web.1]: app/models/user.rb:52:in `confirm!'
指向这条线:UserMailer.welcome_message(self).deliver
这是我的用户邮件类:
class UserMailer < ActionMailer::Base
def welcome_message(user)
@user = user
mail(:to => user.email, :subject => "Welcome to DreamStill")
end
end
您缺少"from:"值,这是SMTP处理的必需值:
class UserMailer < ActionMailer::Base
# Option 1
#default_from "bob@dylan.com"
def welcome_message(user)
@user = user
mail(
# Option 2
:from => "paul@mccarthy.com",
:to => user.email,
:subject => "Welcome to DreamStill"
)
end
end