Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing separate mailer setup, assumes too much

email generation in app would be going to other log file by default
which is confusing.
  • Loading branch information...
commit 07c719b8d9958de73c2e662449a58b7f0f5e9bb8 1 parent 4fcf1cc
@adzap authored
Showing with 8 additions and 12 deletions.
  1. +3 −5 README.rdoc
  2. +5 −7 lib/action_mailer/ar_sendmail.rb
View
8 README.rdoc
@@ -148,11 +148,9 @@ in config/email.yml
port: 25
You can still have ActionMailer settings in each environment file but just be sure
-they don't override these SMTP settings. The other settings should not be needed
-once the email has been generated and stored by ar_mailer in the email table.
-
-The minimal set up will also force the use of a separate mailer log file at
-RAILS_ROOT/log/mailer.log.
+they don't override these SMTP settings. The other settings aren't needed when
+running ar_sendmail since they only apply to the generation of an email which has
+already happened inside the running application.
To avoid duplication of these settings you need to have an initializer which will
will read the same config file and load these settings. This is in case you switch
View
12 lib/action_mailer/ar_sendmail.rb
@@ -283,8 +283,7 @@ def self.load_rails_environment(base_path)
end
# Load a minimal environment to save memory by not loading the entire Rails app.
- # Requires a vendored Rails and mailer config at config/email.yml. It will also
- # use its own separate logger file at log/mailer.log
+ # Requires a vendored Rails and mailer config at config/email.yml.
#
def self.load_minimal_environment(base_path)
Dir.chdir(base_path) do
@@ -297,15 +296,14 @@ def self.load_minimal_environment(base_path)
require 'app/models/email'
env = ENV['RAILS_ENV']
- logger_level = ActiveSupport::BufferedLogger.const_get((env == 'production' ? 'info' : 'debug').upcase)
- ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new(File.join('log', "#{env}.log"))
- ActiveRecord::Base.logger.level = logger_level
+ logger = ActiveSupport::BufferedLogger.new(File.join('log', "#{env}.log"))
+ logger.level = ActiveSupport::BufferedLogger.const_get((env == 'production' ? 'info' : 'debug').upcase)
+ ActiveRecord::Base.logger = ActionMailer::Base.logger = logger
+
db_config = read_config('config/database.yml')
ActiveRecord::Base.establish_connection db_config[env]
- ActionMailer::Base.logger = ActiveSupport::BufferedLogger.new(File.join('log', "mailer.log"))
- ActionMailer::Base.logger.level = logger_level
mailer_config = read_config('config/email.yml')
ActionMailer::Base.smtp_settings = mailer_config[env].symbolize_keys
end
Please sign in to comment.
Something went wrong with that request. Please try again.