title: How to set Action Mailer defaults after config/initializers run?
body: <p>I want to store email account information in a config.yml file.  I'm loading that information into a constant in a Rails config/initializers file following a common pattern I've seen online and outlined <a href="http://railscasts.com/episodes/85-yaml-configuration-file">at this RailsCast</a>.  I'm trying to setup defaults for Action Mailer using config.action_mailer.smtp_settings inside the config/application.rb file, following an example  on <a href="http://matharvard.ca/posts/2011/aug/22/contact-form-in-rails-3/">Mat Harvard's Blog</a>.  I keep getting uninitialized constant errors when starting my rails server.  I'm assuming that application.rb is being called before the config/initializers.  Is there another location where I can set the config.action_mailer.smtp_settings during startup, but after the config/initializers run?</p>
  
  <p>Update:
  I may not have been clear in my initial post/question.  I'm reading the config.yml file in an initializer.  This config file stores email account information such as username and password.  I don't want to put this information (username and password) in either the application.rb or environment.rb files.  I did try moving my code to the environment.rb file, but encountered the same uninitialized constant error when starting rails.</p>
  
  <p>My code to set the action mailer settings looks like this:</p>
  
  <pre><code>  config.action_mailer.smtp_settings = {
      :address              =&gt; APP_CONFIG[:email_config][:address],
      :port                 =&gt; APP_CONFIG[:email_config][:port],
      :domain               =&gt; APP_CONFIG[:email_config][:email_domain],
      :user_name            =&gt; APP_CONFIG[:email_config][:user_name],
      :password             =&gt; APP_CONFIG[:email_config][:password],
      :authentication       =&gt; :plain,
      :enable_starttls_auto =&gt; true
    }
  
    config.action_mailer.default_url_options = {
      :host =&gt; APP_CONFIG[:email_config][:host]
    }
  </code></pre>
  
  <p>I'm reading from the config.yml file to set the APP_CONFIG constant in a load_config.rb initializer.  That file contains the 2 lines below:</p>
  
  <pre><code>raw_config = File.read(RAILS_ROOT + "/config/config.yml")
  APP_CONFIG = YAML.load(raw_config)[RAILS_ENV]
  </code></pre>