hi i am using technoweenie-restful-authentication plug-in for authentication in my application. i want to send a activation link to the user''s mail-id. for that i need to set the smpt server for our rails application, for that i added the follwing code in config/environment.rb file ActionMailer::Base.delivery_method:smpt ActionMailer::Base.smpt_settings = { :address => "localhost", :port => 25, :authentication=> :login, :user_name => "my_username", :password => "my_password" } but when i try to run the server it gives the following errors G:\my\MyMovies>ruby script/server => Booting Mongrel => Rails 2.3.3 application starting on http://0.0.0.0:3000 c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependenci es.rb:443:in `load_missing_constant'': uninitialized constant ActionMailer (NameE rror) from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo rt/dependencies.rb:80:in `const_missing'' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo rt/dependencies.rb:92:in `const_missing'' from G:/my/MyMovies/config/environment.rb:43 from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:111:i n `run'' from G:/my/MyMovies/config/environment.rb:9 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge m_original_require'' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re quire'' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo rt/dependencies.rb:156:in `require'' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo rt/dependencies.rb:521:in `new_constants_in'' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo rt/dependencies.rb:156:in `require'' from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/commands/server.rb:8 4 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge m_original_require'' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re quire'' from script/server:3 any anyone give me the procedure to add smpt server to my rails application is there any any code i need to add in my application to configure my application to the smpt server, if it is please tell me the procedure and which code i need to add. regards, rajendra -- Posted via http://www.ruby-forum.com/.
Did you include these... ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.perform_deliveries = true ActionMailer::Base.delivery_method = :smtp -- Posted via http://www.ruby-forum.com/.
Rails List wrote:> Did you include these... > > ActionMailer::Base.raise_delivery_errors = true > ActionMailer::Base.perform_deliveries = true > ActionMailer::Base.delivery_method = :smtpno, where can i include this code???? -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Jul-28 10:20 UTC
Re: how to set smpt server for our rails applicaion
On Jul 28, 5:17 am, Rajendra Bayana <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> hi i am using technoweenie-restful-authentication plug-in for > authentication in my application. i want to send a activation link to > the user''s mail-id. > for that i need to set the smpt server for our rails application, for > that i added the follwing code in config/environment.rb file >It looks like you''ve got this towards the top of environment.rb, i.e before the bit that runs the initializer: you don''t want this, the initializer is the thing that loads rails, so before it none of the rails framework (ActiveRecord, ActionMailer etc.) is loaded. You''ve also got a few typos in there. Fred> ActionMailer::Base.delivery_method:smpt > ActionMailer::Base.smpt_settings = { > :address => "localhost", > :port => 25, > :authentication=> :login, > :user_name => "my_username", > :password => "my_password" > } > > but when i try to run the server it gives the following errors > > G:\my\MyMovies>ruby script/server > => Booting Mongrel > => Rails 2.3.3 application starting onhttp://0.0.0.0:3000 > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/depen denci > es.rb:443:in `load_missing_constant'': uninitialized constant > ActionMailer (NameE > rror) > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:80:in `const_missing'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:92:in `const_missing'' > from G:/my/MyMovies/config/environment.rb:43 > from > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:111:i > n `run'' > from G:/my/MyMovies/config/environment.rb:9 > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge > m_original_require'' > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re > quire'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:156:in `require'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:521:in `new_constants_in'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:156:in `require'' > from > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/commands/server.rb:8 > 4 > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge > m_original_require'' > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re > quire'' > from script/server:3 > > any anyone give me the procedure to add smpt server to my rails > application > is there any any code i need to add in my application to configure my > application to the smpt server, if it is please tell me the procedure > and which code i need to add. > > regards, > rajendra > -- > Posted viahttp://www.ruby-forum.com/.
Don''t use environment.rb, use instead: "config/initializers/ action_mailer.rb". Set it to read: ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "localhost", :port => 25, :authentication=> :login, :user_name => "my_username", :password => "my_password" } NOTE 1: delivery_method = :smtp NOTE 2: smtp not smpt -- two places On Jul 28, 5:17 am, Rajendra Bayana <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> hi i am using technoweenie-restful-authentication plug-in for > authentication in my application. i want to send a activation link to > the user''s mail-id. > for that i need to set the smpt server for our rails application, for > that i added the follwing code in config/environment.rb file > > ActionMailer::Base.delivery_method:smpt > ActionMailer::Base.smpt_settings = { > :address => "localhost", > :port => 25, > :authentication=> :login, > :user_name => "my_username", > :password => "my_password" > } > > but when i try to run the server it gives the following errors > > G:\my\MyMovies>ruby script/server > => Booting Mongrel > => Rails 2.3.3 application starting onhttp://0.0.0.0:3000 > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependenci > es.rb:443:in `load_missing_constant'': uninitialized constant > ActionMailer (NameE > rror) > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:80:in `const_missing'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:92:in `const_missing'' > from G:/my/MyMovies/config/environment.rb:43 > from > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:111:i > n `run'' > from G:/my/MyMovies/config/environment.rb:9 > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge > m_original_require'' > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re > quire'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:156:in `require'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:521:in `new_constants_in'' > from > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > rt/dependencies.rb:156:in `require'' > from > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/commands/server.rb:8 > 4 > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge > m_original_require'' > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re > quire'' > from script/server:3 > > any anyone give me the procedure to add smpt server to my rails > application > is there any any code i need to add in my application to configure my > application to the smpt server, if it is please tell me the procedure > and which code i need to add. > > regards, > rajendra > -- > Posted viahttp://www.ruby-forum.com/.
What''s the rational behind using initializers instead of environment files? We are (and have been for some time) setting the smtp options in the environment files with great success. Cheers Simon On Tue, 28 Jul 2009 23:40:15 +0800, Rick <richard.t.lloyd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Don''t use environment.rb, use instead: "config/initializers/ > action_mailer.rb". Set it to read: > > ActionMailer::Base.delivery_method = :smtp > > ActionMailer::Base.smtp_settings = { > :address => "localhost", > :port => 25, > :authentication=> :login, > :user_name => "my_username", > :password => "my_password" > } > > > NOTE 1: delivery_method = :smtp > NOTE 2: smtp not smpt -- two places > >
Frederick Cheung
2009-Jul-29 01:33 UTC
Re: how to set smpt server for our rails applicaion
On Jul 28, 7:50 pm, "Simon Macneall" <macne...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What''s the rational behind using initializers instead of environment files? > We are (and have been for some time) setting the smtp options in the > environment files with great success. >That rather than having environment.rb become a dumping ground you have a descriptively named set of files. Another incentive is that initializers run before your models are loaded (in production mode) whereas something at the bottom of environment.rb runs afterwards which can sometimes be problematic. Fred> Cheers > Simon > > > > On Tue, 28 Jul 2009 23:40:15 +0800, Rick <richard.t.ll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Don''t use environment.rb, use instead: "config/initializers/ > > action_mailer.rb". Set it to read: > > > ActionMailer::Base.delivery_method = :smtp > > > ActionMailer::Base.smtp_settings = { > > :address => "localhost", > > :port => 25, > > :authentication=> :login, > > :user_name => "my_username", > > :password => "my_password" > > } > > > NOTE 1: delivery_method = :smtp > > NOTE 2: smtp not smpt -- two places
Seemingly Similar Threads
- "no such file to load -- gettext/rails" error
- smpt server
- FW: Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux
- Rails 1.2 / Theme support plugin issue: Fix
- problem installing webOrb => Plugin not found: "http://themidnightcoders.net:8089/svn/weborb"