So here is the error I get:
********ERROR WHEN CREATING NEW USER*************
Errno::ECONNREFUSED in UsersController#create
app/controllers/users_controller.rb:47:in `block in create'
app/controllers/users_controller.rb:45:in `create'
**********UsersController#create*****************
def create
@user = User.new(params[:user])
respond_to do |format| <--- LINE 45 --->
if @user.save
UserMailer.send_email(@user).deliver <--- LINE 47 -->
format.html { redirect_to @user, notice: 'User was successfully
created.' }
format.json { render json: @user, status: :created, location:
@user }
else
format.html { render action: "new" }
format.json { render json: @user.errors, status:
:unprocessable_entity }
end
end
end
*****************UserMailer**********************
class UserMailer < ActionMailer::Base
default from: "myaddress@gmail.com"
def send_email(user)
@user = user
mail(:to => "#{user.name} <#{user.email}>", :subject =>
"Registered")
end
end
*******Config/Environments/development.rb*********
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'localhost:3000',
:authentication => :login,
:content_type => "text/html",
:user_name => 'myemail@gmail.com',
:password => 'mypassword'
}
I hope I gave enough information!
If needed, please ask for more