Error sending email with gmail "Rails 3.2.6" "ruby 1.8.7"
when trying to send an e-mail from a "going" created. I get the error:
"NameError (undefined methodLocal variable or params' for #): app /
mailers / going_mailer.rb: 5: inregistration_confirmation ' app /
controllers / goings_controller.rb: 12: in create ' app / controllers /
goings_controller.rb: 10: increate '"
my GoingsController
class GoingsController < InheritedResources::Baseload_and_authorize_resource
@going2 = Going.new(params[:going])
@procedure = Procedure.find(params[:procedure_id])
@going = @procedure.goings.create(params[:going])
@procedure.status = @going.status
@procedure.date_modified = @going.entry
@procedure.update_attributes({:status_id => @going.status},
:date_modified => @going.entry)
respond_to do |format|
if @going.save
GoingMailer.registration_confirmation(@going2).deliver
format.html { redirect_to(@going2, :notice => 'Going was
successfully created.') }
format.xml { render :xml => @going2, :status => :created, :location =>
@going2 }
else
format.html { render :action => "new" }
format.xml { render :xml => @going2.errors, :status =>
:unprocessable_entity }
end
redirect_to procedure_path(@procedure) end`
my app/GoingMailer
class GoingMailer < ActionMailer::Base
default :from => "email@gmail.com"
def registration_confirmation(going)
@procedure = Procedure.find(params[:procedure_id])
mail(:to => procedure.victim.analist.email, :subject => "Registered")
end
end
my / Config / initializers / setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydo.com.br",
:user_name => "myemail@gmail.com",
:password => "mypass$",
:authentication => :plain,
:enable_starttls_auto => true
}
No comments:
Post a Comment