ActionMailer ruby on rails no envia los correos

Z

No hay manera de que la aplicacion envie el correo para restaurar la contraseña del usuario.
tengo esta configuración en config/environment/development.rb

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = {
    :host => 'localhost',
    :port => '3000'
  }
  # Options: :smtp, :test
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  :address => 'smtp.gmail.com',
  :port => 587,
  :domain => 'gmail.com',
  :user_name => '[email protected]',
  :password => 'mi contraseña',
  :authentication => :plain,
  :enable_starttls_auto => true }
  

Este el método del controlador que se supone que debería enviar los correos

def create  
@user = User.find_by_email(params[:email])
if @user
@user.deliver_password_reset_instructions!
render 'password_reset_instructions' else
flash[:notice] = "No user was found with that email address"
render :action => :new
end
end

y este es el método deliver_password_reset_instructions! del modelo user

def deliver_password_reset_instructions!  
reset_perishable_token!
Notifier.deliver_password_reset_instructions(self)
end
Dorenz

Puedes postear el log de cuando intentas enviarlo? Estás utilizando Devise?

1 respuesta
Z

#2 Estoy usando authlogic, es lo primero que hago en ruby on rails y no tengo mucha idea... este es el log al intentar recuperar mi contraseña

tarted POST "/password_resets/create" for 127.0.0.1 at 2014-05-31 12:37:15 +0200
Processing by PasswordResetsController#create as HTML
  Parameters: {"email"=>"[email protected]", "commit"=>"Cambiar contraseña"}
WARNING: Can't verify CSRF token authenticity
   [1m [36mUser Load (0.3ms) [0m   [1mSELECT `users`.* FROM `users` WHERE `users`.`email` = '[email protected]' LIMIT 1 [0m
   [1m [35m (0.1ms) [0m  BEGIN
   [1m [36m (0.7ms) [0m   [1mUPDATE `users` SET `perishable_token` = 'NltRXKJXaTRzcLRRaJD', `updated_at` = '2014-05-31 10:37:15' WHERE `users`.`id` = 1 [0m
   [1m [35m (97.0ms) [0m  COMMIT
  Rendered password_resets/password_reset_instructions.erb within layouts/application (0.0ms)
ApplicationController::current_user
ApplicationController::current_user_session
   [1m [36m (0.5ms) [0m   [1mSELECT COUNT(*) FROM `users`  [0m
Completed 200 OK in 113ms (Views: 4.0ms | ActiveRecord: 98.7ms)


Started GET "/assets/style.css?body=1" for 127.0.0.1 at 2014-05-31 12:37:15 +0200
Served asset /style.css - 304 Not Modified (0ms)

Usuarios habituales