views:

36

answers:

0

When trying to send an email to the user for reseting their password, I keep getting an execution timed out error. Other mailer functions work, so I know that the config settings are correct. The header reads: "Timeout::Error in Password resetsController#create"

Here is the password_resets_controller:

def create  
 @user = User.find_by_email(params[:email])  
 if @user  
  User.deliver_password_reset_instructions(@user.id)
  flash[:notice] = "Instructions to reset your password have been emailed to you. " +  
  "Please check your email."  
  redirect_to '/'  
 else  
  flash[:notice] = "No user was found with that email address"  
  render :action => :new
 end  
end

Here is the method inside of User.rb

def self.deliver_password_reset_instructions(user_id)
 user = User.find(user_id)
 user.reset_perishable_token!  
 Emailer.deliver_password_reset_instructions(user)
end

Finally, here is the actual method inside of emailer.rb:

default_url_options[:host] = "http://0.0.0.0:3000"  #development
 def password_reset_instructions(user)  
    @subject                            = "Application Password Reset"  
    @from                               = '[email protected]' 
    @recipients                         = user.email  
    @sent_on                            = Time.now  
    @body["edit_password_reset_url"]    =  edit_password_reset_url(user.perishable_token)  
    @headers["X-SMTPAPI"] = "{\"category\" : \"Password Recovery\"}"#send grid category header
  end

Why is "Password" in the error message referred to causing a timeout::error