aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-01-31 02:09:45 +0000
committerMichael Koziarski <michael@koziarski.com>2007-01-31 02:09:45 +0000
commit27bb903aa068fc61c79bec53a7f4d524e935cf0f (patch)
treeed34566397a14c0e9ec98066941b88cf9534fb0d
parent3f4cbccb9cf4cf03ce81c43cbd155a818df4c04f (diff)
downloadrails-27bb903aa068fc61c79bec53a7f4d524e935cf0f.tar.gz
rails-27bb903aa068fc61c79bec53a7f4d524e935cf0f.tar.bz2
rails-27bb903aa068fc61c79bec53a7f4d524e935cf0f.zip
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
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionmailer/lib/action_mailer/base.rb18
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:
# * <tt>logger</tt> - 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.
#
- # * <tt>server_settings</tt> - Allows detailed configuration of the server:
+ # * <tt>smtp_settings</tt> - Allows detailed configuration for :smtp delivery method:
# * <tt>:address</tt> Allows you to use a remote mail server. Just change it from its default "localhost" setting.
# * <tt>:port</tt> On the off chance that your mail server doesn't run on port 25, you can change it.
# * <tt>:domain</tt> If you need to specify a HELO domain, you can do it here.
@@ -193,10 +193,12 @@ module ActionMailer #:nodoc:
# * <tt>:authentication</tt> 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
#
+ # * <tt>sendmail_settings</tt> - Allows you to override options for the :sendmail delivery method
+ # * <tt>:location</tt> The location of the sendmail executable, defaults to "/usr/sbin/sendmail"
+ # * <tt>:arguments</tt> The command line arguments
# * <tt>raise_delivery_errors</tt> - whether or not errors should be raised if the email fails to be delivered.
#
# * <tt>delivery_method</tt> - Defines a delivery method. Possible values are :smtp (default), :sendmail, and :test.
- # Sendmail is assumed to be present at "/usr/sbin/sendmail".
#
# * <tt>perform_deliveries</tt> - 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