On 8 October 2012 21:22, Remi B. <[email protected]> wrote: > 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: "[email protected]" > > 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 => '[email protected]', > :password => 'mypassword' > }
I have not done this myself but [1] suggests the authentication should be :plain. There are other detail differences also. Colin [1] http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

