Skip to content

Instantly share code, notes, and snippets.

@tubbo
Forked from almaron/mailer_settings.rb
Created November 12, 2012 16:39
Show Gist options
  • Select an option

  • Save tubbo/4060379 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/4060379 to your computer and use it in GitHub Desktop.
options = ActiveSupport::HashWithIndifferentAccess.new(YAML.load_file("#{Rails.root}/config/mailer.yml")[Rails.env])
ActionMailer::Base.smtp_settings = options[:smtp]
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_url_options[:host] = options[:host]
ActionMailer::Base.raise_delivery_errors = true if Rails.env.development?
require 'development_mail_interceptor'
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment