Reputation: 13548
When I click on the link in my confirmation email that devise sends, it seems to go to a path that is not recognized by my application.
The url looks something like this:
http://glowing-flower-855.heroku.com/users/confirmation?confirmation_token=lIUuOINyxfTW3TBPPI
which looks correct, but it seems to go to my 500.html file.
It has something to do with this code in my user model that overrides Devise's confirm!
method:
def confirm!
UserMailer.welcome_message(self).deliver
super
end
According to my logs, this is the error:
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!'
which points to this line: UserMailer.welcome_message(self).deliver
Here's my user mailer class:
class UserMailer < ActionMailer::Base
def welcome_message(user)
@user = user
mail(:to => user.email, :subject => "Welcome to DreamStill")
end
end
Upvotes: 1
Views: 3171
Reputation: 4381
You are missing the "from:" value, it's a must for SMTP handling:
class UserMailer < ActionMailer::Base
# Option 1
#default_from "[email protected]"
def welcome_message(user)
@user = user
mail(
# Option 2
:from => "[email protected]",
:to => user.email,
:subject => "Welcome to DreamStill"
)
end
end
Upvotes: 6