Ruby on Rails Monday, August 29, 2011

...is like to have a cutter that doesn't cut! :)

Hello, I'm working on Action Mailer, with a simple email confirmation
when a user signs up.

So, basically when I try to register myself on my local server, the
registration goes just fine, without errors nor failures, but I
ultimately don't receive any email from myself, even though the app is
supposed and structured to do so.

For instance , I have the Notifier model structured so :

class Notifier < ActionMailer::Base
default :from => "###MY EMAIL###"

def welcome(user)

@user = user

mail (:to => user.email , :subject => "Signed up successfully")
end
end

...and my UserController :

def create
@user = User.new(params[:user])

respond_to do |format|
if @user.save
Notifier.welcome(@user).deliver
format.html { redirect_to(@user, :notice => "User #{@user.name }
was successfully created.") }
format.xml { render :xml => @user, :status => :created,
:location => @user }
else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status =>
:unprocessable_entity }
end
end
end

I've got a Gmail account , and in my environments/development.rb I
configured the gmail account in this way :

config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:authentication => "plain",
:user_name => "MY EMAIL",
:password => '#MY PASSWORD',
:enable_starttls_auto => true
}

Any idea???

Thank you very much!
Leo

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment