I'm trying to setup e-mail actions in my Rails app and I want to test the mailing functions locally. I followed this Railscast but sending mail throws a Timeout::Error(execution expired)
error whenever I attempt to send mail.
config/environments/development.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config/initializers/setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'recipes.dev',
:user_name => '[email protected]',
:password => '*******',
:authentication => 'plain',
:enable_starttls_auto => true
}
mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def test_email(user)
@email = user.email
@name = user.name
mail(:to => @email, :subject => 'test e-mail')
end
end
controllers/users_controller.rb
UserMailer.test_email(@user).deliver
Any help would be appreciated.