From 27bb903aa068fc61c79bec53a7f4d524e935cf0f Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Wed, 31 Jan 2007 02:09:45 +0000 Subject: Rename server_settings to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Koz] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6095 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionmailer/CHANGELOG | 2 ++ actionmailer/lib/action_mailer/base.rb | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 2942a9c072..157c975ef0 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Rename server_settings to smtp settings, and add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Koz] + * Allow mailer actions named send by using __send__ internally. #6467 [iGEL] * Add assert_emails and assert_no_emails to test the number of emails delivered. #6479 [Jonathan Viney] diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index b256016d94..6bbc710942 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -184,7 +184,7 @@ module ActionMailer #:nodoc: # * logger - the logger is used for generating information on the mailing run if available. # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers. # - # * server_settings - Allows detailed configuration of the server: + # * smtp_settings - Allows detailed configuration for :smtp delivery method: # * :address Allows you to use a remote mail server. Just change it from its default "localhost" setting. # * :port On the off chance that your mail server doesn't run on port 25, you can change it. # * :domain If you need to specify a HELO domain, you can do it here. @@ -193,10 +193,12 @@ module ActionMailer #:nodoc: # * :authentication If your mail server requires authentication, you need to specify the authentication type here. # This is a symbol and one of :plain, :login, :cram_md5 # + # * sendmail_settings - Allows you to override options for the :sendmail delivery method + # * :location The location of the sendmail executable, defaults to "/usr/sbin/sendmail" + # * :arguments The command line arguments # * raise_delivery_errors - whether or not errors should be raised if the email fails to be delivered. # # * delivery_method - Defines a delivery method. Possible values are :smtp (default), :sendmail, and :test. - # Sendmail is assumed to be present at "/usr/sbin/sendmail". # # * perform_deliveries - Determines whether deliver_* methods are actually carried out. By default they are, # but this can be turned off to help functional testing. @@ -228,7 +230,7 @@ module ActionMailer #:nodoc: class_inheritable_accessor :template_root cattr_accessor :logger - @@server_settings = { + @@smtp_settings = { :address => "localhost", :port => 25, :domain => 'localhost.localdomain', @@ -236,7 +238,13 @@ module ActionMailer #:nodoc: :password => nil, :authentication => nil } - cattr_accessor :server_settings + cattr_accessor :smtp_settings + + @@sendmail_settings = { + :location => '/usr/sbin/sendmail', + :arguments => '-i -t' + } + cattr_accessor :sendmail_settings @@raise_delivery_errors = true cattr_accessor :raise_delivery_errors @@ -549,7 +557,7 @@ module ActionMailer #:nodoc: end def perform_delivery_sendmail(mail) - IO.popen("/usr/sbin/sendmail -i -t","w+") do |sm| + IO.popen("#{sendmail_settings[:location]} #{sendmail_settings[:arguments]}","w+") do |sm| sm.print(mail.encoded.gsub(/\r/, '')) sm.flush end -- cgit v1.2.3