title: Send Reset Password Instructions with Devise
body: <p>I am trying to send reset password instructions using devise with Rails.  The user clicks the 'forgot password link', then they enter their email address to receive the reset password instructions.  I see the email is sent in the dev log, but I am not receiving my test email and I see the error below.  Any ideas on what I am doing incorrectly? </p>
  
  <pre><code>Timeout::Error - execution expired
  </code></pre>
  
  <p>In user_mailer.rb, I have the following:</p>
  
  <pre><code>class UserMailer &lt; ActionMailer::Base
   include Devise::Mailers::Helpers
  
   default :from =&gt; ENV["EMAIL_ADDRESS"]
  
   def reset_password_instructions(record, opts={})
    mail(:to =&gt; record, :subject =&gt; "Reset Password Instructions")
   end
  
  end
  </code></pre>
  
  <p>I am testing in development, so my development.rb has the following:</p>
  
  <pre><code># ActionMailer Config
  config.action_mailer.default_url_options = { :host =&gt; 'localhost:3000' }
  config.action_mailer.delivery_method = :smtp
  # change to true to allow email to be sent during development
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default :charset =&gt; "utf-8"
  
  config.action_mailer.smtp_settings = {
  :address   =&gt; "smtp.mandrillapp.com",
  :port      =&gt; 25,
  :user_name =&gt; ENV["MANDRILL_USERNAME"],
  :password  =&gt; ENV["MANDRILL_API_KEY"],
  :enable_starttls_auto =&gt; true, # detects and uses STARTTLS
  :authentication =&gt; 'login', # Mandrill supports 'plain' or 'login'
  :domain =&gt; 'mydomain.com', # your domain to identify your server when connecting
  }
  </code></pre>
  
  <p>And in user.rb, I have the following:</p>
  
  <pre><code>def send_reset_password_instructions
   UserMailer.reset_password_instructions(self.email).deliver
  end
  </code></pre>
  
  <p>As I mentioned above, I am seeing the email being generated in the logs right before it times out - below is the full stack trace:</p>
  
  <pre><code>Started GET "/users/password/new" for 127.0.0.1 at 2013-10-10 17:32:24 -0500
  Processing by Devise::PasswordsController#new as HTML
  Rendered devise/passwords/new.html.erb within layouts/application (3.7ms)
  Rendered layouts/_navigation.html.erb (1.6ms)
  Rendered layouts/_messages.html.erb (0.1ms)
  Completed 200 OK in 101ms (Views: 100.6ms | ActiveRecord: 0.0ms)
  
  
  Started POST "/users/password" for 127.0.0.1 at 2013-10-10 17:32:28 -0500
  Processing by Devise::PasswordsController#create as HTML
  Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"CebAAlhJgxz1yDEi5BvsJ/dOdUpAHl08yrG1NCVgi/o=", "user"=&gt;{"email"=&gt;"me@gmail.com"}, "commit"=&gt;"Continue"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."email" = 'me@gmail.com' LIMIT 1
  Rendered user_mailer/reset_password_instructions.html.erb (0.1ms)
  
  Sent mail to me@gmail.com (30018ms)
  Date: Thu, 10 Oct 2013 17:32:28 -0500
  From: info@mydomain.com
  To: me@gmail.com
  Message-ID: &lt;52572afc78c10_e9e43ffb7d69b4ec31274@Patricks-MacBook-Air.local.mail&gt;
  Subject: Reset Password Instructions
  Mime-Version: 1.0
  Content-Type: text/html;
  charset=UTF-8
  Content-Transfer-Encoding: 7bit
  
  &lt;p&gt;Hello!&lt;/p&gt;
  
  &lt;p&gt;Someone has requested a link to change your password. You can do this through the link below.&lt;/p&gt;
  
  
  
  &lt;p&gt;If you didn't request this, please ignore this email.&lt;/p&gt;
  &lt;p&gt;Your password won't change until you access the link above and create a new one.&lt;/p&gt;
  
  Completed 500 Internal Server Error in 30044ms
  </code></pre>