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
This commit is contained in:
Michael Koziarski
2007-01-31 02:09:45 +00:00
parent 3f4cbccb9c
commit 27bb903aa0
2 changed files with 15 additions and 5 deletions

View File

@@ -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]

View File

@@ -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