diff options
| author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-15 20:03:45 +1100 | 
|---|---|---|
| committer | José Valim <jose.valim@gmail.com> | 2010-01-16 14:02:55 +0100 | 
| commit | 5b0c8a1266016c6418555399da83fbc7210c6734 (patch) | |
| tree | 0ba46e7ea96be2e9aaff838bbf56338367b7fd5f | |
| parent | 5a52523a800c8a57d1ad80ad3a0ba81711cce38e (diff) | |
| download | rails-5b0c8a1266016c6418555399da83fbc7210c6734.tar.gz rails-5b0c8a1266016c6418555399da83fbc7210c6734.tar.bz2 rails-5b0c8a1266016c6418555399da83fbc7210c6734.zip  | |
Removing internal delivery agents
5 files changed, 0 insertions, 141 deletions
diff --git a/actionmailer/lib/action_mailer/delivery_method.rb b/actionmailer/lib/action_mailer/delivery_method.rb deleted file mode 100644 index 4f7d3afc3c..0000000000 --- a/actionmailer/lib/action_mailer/delivery_method.rb +++ /dev/null @@ -1,56 +0,0 @@ -require 'active_support/core_ext/class' - -module ActionMailer -  module DeliveryMethod -    autoload :File,     'action_mailer/delivery_method/file' -    autoload :Sendmail, 'action_mailer/delivery_method/sendmail' -    autoload :Smtp,     'action_mailer/delivery_method/smtp' -    autoload :Test,     'action_mailer/delivery_method/test' - -    # Creates a new DeliveryMethod object according to the given options. -    # -    # If no arguments are passed to this method, then a new -    # ActionMailer::DeliveryMethod::Stmp object will be returned. -    # -    # If you pass a Symbol as the first argument, then a corresponding -    # delivery method class under the ActionMailer::DeliveryMethod namespace -    # will be created. -    # For example: -    # -    #   ActionMailer::DeliveryMethod.lookup_method(:sendmail) -    #   # => returns a new ActionMailer::DeliveryMethod::Sendmail object -    # -    # If the first argument is not a Symbol, then it will simply be returned: -    # -    #   ActionMailer::DeliveryMethod.lookup_method(MyOwnDeliveryMethod.new) -    #   # => returns MyOwnDeliveryMethod.new -    def self.lookup_method(delivery_method) -      case delivery_method -      when Symbol -        method_name  = delivery_method.to_s.camelize -        method_class = ActionMailer::DeliveryMethod.const_get(method_name) -        method_class.new -      when nil # default -        Smtp.new -      else -        delivery_method -      end -    end - -    # An abstract delivery method class. There are multiple delivery method classes. -    # See the classes under the ActionMailer::DeliveryMethod, e.g. -    # ActionMailer::DeliveryMethod::Smtp. -    # Smtp is the default delivery method for production -    # while Test is used in testing. -    # -    # each delivery method exposes just one method -    # -    #   delivery_method = ActionMailer::DeliveryMethod::Smtp.new -    #   delivery_method.perform_delivery(mail) # send the mail via smtp -    # -    class Method -      superclass_delegating_accessor :settings -      self.settings = {} -    end -  end -end diff --git a/actionmailer/lib/action_mailer/delivery_method/file.rb b/actionmailer/lib/action_mailer/delivery_method/file.rb deleted file mode 100644 index 571e32df49..0000000000 --- a/actionmailer/lib/action_mailer/delivery_method/file.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'tmpdir' - -module ActionMailer -  module DeliveryMethod - -    # A delivery method implementation which writes all mails to a file. -    class File < Method -      self.settings = { -        :location       => defined?(Rails.root) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails" -      } - -      def perform_delivery(mail) -        FileUtils.mkdir_p settings[:location] - -        mail.destinations.uniq.each do |to| -          ::File.open(::File.join(settings[:location], to), 'a') { |f| f.write(mail) } -        end -      end -    end -  end -end diff --git a/actionmailer/lib/action_mailer/delivery_method/sendmail.rb b/actionmailer/lib/action_mailer/delivery_method/sendmail.rb deleted file mode 100644 index db55af79f1..0000000000 --- a/actionmailer/lib/action_mailer/delivery_method/sendmail.rb +++ /dev/null @@ -1,22 +0,0 @@ -module ActionMailer -  module DeliveryMethod - -    # A delivery method implementation which sends via sendmail. -    class Sendmail < Method -      self.settings = { -        :location       => '/usr/sbin/sendmail', -        :arguments      => '-i -t' -      } - -      def perform_delivery(mail) -        sendmail_args = settings[:arguments] -        sendmail_args += " -f \"#{mail['return-path']}\"" if mail['return-path'] -        IO.popen("#{settings[:location]} #{sendmail_args}","w+") do |sm| -          sm.print(mail.encoded.gsub(/\r/, '')) -          sm.flush -        end -      end -    end - -  end -end diff --git a/actionmailer/lib/action_mailer/delivery_method/smtp.rb b/actionmailer/lib/action_mailer/delivery_method/smtp.rb deleted file mode 100644 index af30c498b5..0000000000 --- a/actionmailer/lib/action_mailer/delivery_method/smtp.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'net/smtp' - -module ActionMailer -  module DeliveryMethod -    # A delivery method implementation which sends via smtp. -    class Smtp < Method -      self.settings = { -        :address              => "localhost", -        :port                 => 25, -        :domain               => 'localhost.localdomain', -        :user_name            => nil, -        :password             => nil, -        :authentication       => nil, -        :enable_starttls_auto => true, -      } - -      def perform_delivery(mail) -        destinations = mail.destinations -        sender = (mail['return-path'] && mail['return-path'].address) || mail['from'] - -        smtp = Net::SMTP.new(settings[:address], settings[:port]) -        smtp.enable_starttls_auto if settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) -        smtp.start(settings[:domain], settings[:user_name], settings[:password], -                   settings[:authentication]) do |smtp| -          smtp.sendmail(mail.encoded, sender, destinations) -        end -      end -    end -  end -end diff --git a/actionmailer/lib/action_mailer/delivery_method/test.rb b/actionmailer/lib/action_mailer/delivery_method/test.rb deleted file mode 100644 index 6e3239d52a..0000000000 --- a/actionmailer/lib/action_mailer/delivery_method/test.rb +++ /dev/null @@ -1,12 +0,0 @@ -module ActionMailer -  module DeliveryMethod - -    # A delivery method implementation designed for testing, which just appends each record to the :deliveries array -    class Test < Method -      def perform_delivery(mail) -        ActionMailer::Base.deliveries << mail -      end -    end - -  end -end  | 
