small medium large xlarge

John_bigger_pragsmall
14 May 2010, 14:44
John Ranaudo (5 posts)

Its not clear on how to add the email delivery and settings from page 176-177? To use the same configuration for dev, testing and prod do I edit the environment.rb file and add the email configurations and settings? See example below:

######### environment.rb file ###########

# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Depot::Application.initialize!

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com" ,
:port => 587,
:domain => "mydomain.com" ,
:authentication => 'plain' ,
:user_name => "john@mydomain.com" ,
:password => "somepassword" ,
:enable_starttls_auto => true
}
 
Samr_small_pragsmall
14 May 2010, 19:04
Sam Ruby (634 posts)

You are adding it to the right place. The user_name looks suspect, but that might just be the forum software trying to be helpful.

Is this not working for you? What is the symptom?

John_bigger_pragsmall
14 May 2010, 19:47
John Ranaudo (5 posts)

Yes, the user_name is john@mydomain.com only.

Symptom: After I apply the updates to the environment.rb file I get the following error when starting the server.

=> Booting WEBrick
=> Rails 3.0.0.beta3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/my.name/dev/depot/config/environment.rb:13: undefined local variable or method `config' for main:Object (NameError)
        from config.ru:3:in `require'
        from config.ru:3
        from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
        from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
        from config.ru:1:in `new'
        from config.ru:1

Line 13 in environment.rb is ~~~ config.action_mailer.delivery_method = :smtp ~~~

Samr_small_pragsmall
15 May 2010, 02:11
Sam Ruby (634 posts)

I’ve reproduced the problem. Around the config lines, add:

Depot::Application.configure do
  ...
end

I’ll fix this in the next beta. Thanks for reporting it!

Generic-user-small
08 Dec 2010, 19:34
J K (1 post)

I don’t get any error while I run the app, but I don’t get any email.

`
Waterloop3::Application.configure do
  #---Send out email
  config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "gmail.com",
    :authentication => "plain",
    :user_name => "someone [at] gmail.com",
    :password => "some password",
    :enable_starttls_auto => true
  }
  
end
`
Generic-user-small
09 Mar 2011, 15:24
Dave Newberry (2 posts)

Likewise. Any hints as to how I can figure out where this has stopped working? Everything looks fine in the development.log

Generic-user-small
09 Mar 2011, 15:40
Dave Newberry (2 posts)

I got this to work by putting the port setting in quotes.

`
Depot::Application.configure do
  config.action_mailer.delivery_method = :smtp
  
  config.action_mailer.smtp_settings = {
    :address                => "smtp.gmail.com",
    :port                   => "587",
    :domain                 => "gmail.com",
    :authentication         => "plain",
    :user_name              => "myemail[at]gmail.com",
    :password               => "mypassword",
    :enable_starttls_auto   => true
  }
`
You must be logged in to comment