I''m new to RoR - but learning quickly.
I''ve run through all the simple tutorials on how to start a basic RoR
app, and have purchased the Agile book on RoR and gone through the
web store tutorial it offers.
I''m now beginning a new application and am seemingly stuck almost
before I''ve begun.
This application will require a valid username/password to access,
and following the suggestion in the Agile book, I decided to try out
the Salted Hash Login Generator. Following the instructions found on
the SHLG wiki: http://wiki.rubyonrails.com/rails/show/
SaltedLoginGeneratorQuickstart I was able (with some slight tweaking
to accomodate a few extra fields I have in my users table) to get the
login screen to appear. "Great!" I thought - didn''t take
very long,
and actually looks like it will work. Course, my users table was at
this point empty, so I hit the link to create a new account, filled
in all the required info, and Boom (in your best Steve Job''s voice) I
get the following message:
"Error creating account: confirmation email not sent"
So, I crack open the development log to see what''s up, and I see the
following: (some items altered to protect the guilty)
Sent mail:
Date: Fri, 9 Sep 2005 09:57:49 -0600
From: valid-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org
To: testing-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org
Subject: [My App] Welcome to My App!
Content-Type: text/plain; charset=utf-8
Welcome to My App, jh kjh.
Your login credentials are:
login: testing2
password: testing
Please click on the following link to confirm your registration:
<a href="http://localhost:3000/user/welcome?user[id]
=21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5">Click
me!</a>
http://localhost:3000/user/welcome?user[id]
=21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5
SQL (0.079510) ROLLBACK
Rendering within layouts/scaffold
Rendering user/signup (200 OK)
Completed in 0.23645 (4 reqs/sec) | Rendering: 0.02537 (10%) | DB:
0.08675 (36%) [http://localhost/user/signup]
So, I think to myself that the error must be with my email server...
I must not have set up ActionMailer to do SMTP auth correctly. Here
are the settings (again, some items altered a bit): (this is from
config/environments/development.rb):
ActionMailer::Base.server_settings = {
:address => "192.168.1.4",
:port => 25,
:domain => "domain.com",
:username => "someTest-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org",
:password => "Secret",
:authentication => :login
}
So, after verifying that the settings in development.rb appear
correct, I try again, with the same result. Next I took a look at
the mail server logs, and find that there is never even a connection
attempt being made by my machine. It''s as though ActionMailer is
just not trying. (or at least not trying hard enough...)
I''ve dug through the ActionMailer docs to see if I can make it any
noisier about what is going wrong, but I can''t find anything other
than to redirect the logs it is already producing to another
destination.
What may I be doing wrong?
Thanks!
-- Kimball
On 9/9/05, Kimball Larsen <kimball-MceZc52A0j6Pgb8tOZhbtAC/G2K4zDHf@public.gmane.org> wrote:> I''ve dug through the ActionMailer docs to see if I can make it any > noisier about what is going wrong, but I can''t find anything other > than to redirect the logs it is already producing to another > destination.try inserting a raise statement in the signup method just after the rescue statement... something like: def signup .... rescue raise ... end end that will stop the method from failing with a pretty error and give you the real error. My best guess would be that it''s just a misconfiguration in your actionmailer settings. Depending on what sort of information your SMTP server is expecting the whole affair can get a bit dodgy. Try removing everything but the bare necessities (domain and port) and building back up (referring to the real error messages provided by raise) from there until it starts working again. HTH, Stephen
Kimball, I may be wrong, but I believe that error message is generated from an error handling block that rescues all errors, so the error could be caused by something other than ActionMailer. Edit the code and remove the block to see what error is being generated. You can also run the functional and unit tests on the user system by typing "rake default" at your command line. - Derek On 9/9/05, Kimball Larsen <kimball-MceZc52A0j6Pgb8tOZhbtAC/G2K4zDHf@public.gmane.org> wrote:> I''m new to RoR - but learning quickly. > > I''ve run through all the simple tutorials on how to start a basic RoR > app, and have purchased the Agile book on RoR and gone through the > web store tutorial it offers. > > I''m now beginning a new application and am seemingly stuck almost > before I''ve begun. > > This application will require a valid username/password to access, > and following the suggestion in the Agile book, I decided to try out > the Salted Hash Login Generator. Following the instructions found on > the SHLG wiki: http://wiki.rubyonrails.com/rails/show/ > SaltedLoginGeneratorQuickstart I was able (with some slight tweaking > to accomodate a few extra fields I have in my users table) to get the > login screen to appear. "Great!" I thought - didn''t take very long, > and actually looks like it will work. Course, my users table was at > this point empty, so I hit the link to create a new account, filled > in all the required info, and Boom (in your best Steve Job''s voice) I > get the following message: > > "Error creating account: confirmation email not sent" > > So, I crack open the development log to see what''s up, and I see the > following: (some items altered to protect the guilty) > > Sent mail: > Date: Fri, 9 Sep 2005 09:57:49 -0600 > From: valid-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org > To: testing-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org > Subject: [My App] Welcome to My App! > Content-Type: text/plain; charset=utf-8 > > Welcome to My App, jh kjh. > > Your login credentials are: > > login: testing2 > password: testing > > Please click on the following link to confirm your registration: > > <a href="http://localhost:3000/user/welcome?user[id] > =21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5">Click me!</a> > > http://localhost:3000/user/welcome?user[id] > =21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5 > > SQL (0.079510) ROLLBACK > Rendering within layouts/scaffold > Rendering user/signup (200 OK) > Completed in 0.23645 (4 reqs/sec) | Rendering: 0.02537 (10%) | DB: > 0.08675 (36%) [http://localhost/user/signup] > > > So, I think to myself that the error must be with my email server... > I must not have set up ActionMailer to do SMTP auth correctly. Here > are the settings (again, some items altered a bit): (this is from > config/environments/development.rb): > > ActionMailer::Base.server_settings = { > :address => "192.168.1.4", > :port => 25, > :domain => "domain.com", > :username => "someTest-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org", > :password => "Secret", > :authentication => :login > } > > So, after verifying that the settings in development.rb appear > correct, I try again, with the same result. Next I took a look at > the mail server logs, and find that there is never even a connection > attempt being made by my machine. It''s as though ActionMailer is > just not trying. (or at least not trying hard enough...) > > I''ve dug through the ActionMailer docs to see if I can make it any > noisier about what is going wrong, but I can''t find anything other > than to redirect the logs it is already producing to another > destination. > > What may I be doing wrong? > > Thanks! > > -- Kimball > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Derek Haynes HighGroove Studios - http://www.highgroove.com Keeping it Simple. 404.593.4879
On Sep 9, 2005, at 11:37 AM, Derek Haynes wrote:> Kimball, > > I may be wrong, but I believe that error message is generated from an > error handling block that rescues all errors, so the error could be > caused by something other than ActionMailer. Edit the code and remove > the block to see what error is being generated. > > You can also run the functional and unit tests on the user system by > typing "rake default" at your command line. >Derek, Thanks for the advice. As you suggested, I removed the rescue for this error, and now get this message: Net::SMTPSyntaxError in User#signup 501 Syntax: HELO hostname /app/controllers/user_controller.rb:28:in `signup'' /app/controllers/user_controller.rb:22:in `transaction'' /app/controllers/user_controller.rb:22:in `signup'' script/server:49 So, am I to believe that either my hostname is malformed or that ActionMailer is not providing a good HELO? rake default (with the rescue commented) results in this: 1) Error: test_signup(UserControllerTest): RuntimeError: Failed to send email /Users/quangdog/Rails/test/config/../test/mocks/test/ user_notify.rb:11:in `perform_delivery_test'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.0.1/lib/action_mailer/ base.rb:233:in `send'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.0.1/lib/action_mailer/ base.rb:233:in `deliver!'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.0.1/lib/action_mailer/ base.rb:342:in `method_missing'' . . . /usr/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/ action_controller/test_process.rb:275:in `process'' (eval):3:in `post'' ./test/functional/user_controller_test.rb:78:in `do_test_signup'' ./test/functional/user_controller_test.rb:144:in `test_signup'' 9 tests, 255 assertions, 0 failures, 1 errors rake aborted! With the rescue block in place, it passes all rake tests. Thanks! -- Kimball> - Derek > > On 9/9/05, Kimball Larsen <kimball-MceZc52A0j6Pgb8tOZhbtAC/G2K4zDHf@public.gmane.org> wrote: > >> I''m new to RoR - but learning quickly. >> >> I''ve run through all the simple tutorials on how to start a basic RoR >> app, and have purchased the Agile book on RoR and gone through the >> web store tutorial it offers. >> >> I''m now beginning a new application and am seemingly stuck almost >> before I''ve begun. >> >> This application will require a valid username/password to access, >> and following the suggestion in the Agile book, I decided to try out >> the Salted Hash Login Generator. Following the instructions found on >> the SHLG wiki: http://wiki.rubyonrails.com/rails/show/ >> SaltedLoginGeneratorQuickstart I was able (with some slight tweaking >> to accomodate a few extra fields I have in my users table) to get the >> login screen to appear. "Great!" I thought - didn''t take very long, >> and actually looks like it will work. Course, my users table was at >> this point empty, so I hit the link to create a new account, filled >> in all the required info, and Boom (in your best Steve Job''s voice) I >> get the following message: >> >> "Error creating account: confirmation email not sent" >> >> So, I crack open the development log to see what''s up, and I see the >> following: (some items altered to protect the guilty) >> >> Sent mail: >> Date: Fri, 9 Sep 2005 09:57:49 -0600 >> From: valid-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org >> To: testing-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org >> Subject: [My App] Welcome to My App! >> Content-Type: text/plain; charset=utf-8 >> >> Welcome to My App, jh kjh. >> >> Your login credentials are: >> >> login: testing2 >> password: testing >> >> Please click on the following link to confirm your registration: >> >> <a href="http://localhost:3000/user/welcome?user[id] >> =21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5">Click me!</a> >> >> http://localhost:3000/user/welcome?user[id] >> =21&key=176e10ed73abd23c2c1c4393d3099ac19a4d9ac5 >> >> SQL (0.079510) ROLLBACK >> Rendering within layouts/scaffold >> Rendering user/signup (200 OK) >> Completed in 0.23645 (4 reqs/sec) | Rendering: 0.02537 (10%) | DB: >> 0.08675 (36%) [http://localhost/user/signup] >> >> >> So, I think to myself that the error must be with my email server... >> I must not have set up ActionMailer to do SMTP auth correctly. Here >> are the settings (again, some items altered a bit): (this is from >> config/environments/development.rb): >> >> ActionMailer::Base.server_settings = { >> :address => "192.168.1.4", >> :port => 25, >> :domain => "domain.com", >> :username => "someTest-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org", >> :password => "Secret", >> :authentication => :login >> } >> >> So, after verifying that the settings in development.rb appear >> correct, I try again, with the same result. Next I took a look at >> the mail server logs, and find that there is never even a connection >> attempt being made by my machine. It''s as though ActionMailer is >> just not trying. (or at least not trying hard enough...) >> >> I''ve dug through the ActionMailer docs to see if I can make it any >> noisier about what is going wrong, but I can''t find anything other >> than to redirect the logs it is already producing to another >> destination. >> >> What may I be doing wrong? >> >> Thanks! >> >> -- Kimball >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > > -- > Derek Haynes > HighGroove Studios - http://www.highgroove.com > Keeping it Simple. > 404.593.4879 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I found my problem.... On Sep 9, 2005, at 10:04 AM, Kimball Larsen wrote:> > So, I think to myself that the error must be with my email > server... I must not have set up ActionMailer to do SMTP auth > correctly. Here are the settings (again, some items altered a > bit): (this is from config/environments/development.rb): > > ActionMailer::Base.server_settings = { > :address => "192.168.1.4", > :port => 25, > :domain => "domain.com", > :username => "someTest-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org",This should be :user_name, not :username.> :password => "Secret", > :authentication => :login > }That''s what I get for reading docs too fast. ;-) Thanks to everyone who replied. -- Kimball