1
votes

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
1
What's in your logs, regarding the errors?sevenseacat
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!'Justin Meltzer
it's pointing to this line UserMailer.welcome_message(self).deliverJustin Meltzer
Can you show us your mailer class? Also, are you using Rails 3?Ben Orozco
posted my mailer class. yeah, Rails 3Justin Meltzer

1 Answers

7
votes

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