class Mail::Configuration - mail-2.5.4 Documentation

# class Mail::Configuration

The Configuration class is a Singleton used to hold the default configuration for all Mail objects.

Each new mail object gets a copy of these values at initialization which can be overwritten on a per mail object basis.

### Public Class Methods

new() click to toggle source
Calls superclass method

    # File lib/mail/configuration.rb, line 16
    def initialize
      @delivery_method  = nil
      @retriever_method = nil
      super
    end

### Public Instance Methods

delivery_method(method = nil, settings = {}) click to toggle source

    # File lib/mail/configuration.rb, line 22
    def delivery_method(method = nil, settings = {})
      return @delivery_method if @delivery_method && method.nil?
      @delivery_method = lookup_delivery_method(method).new(settings)
    end

lookup_delivery_method(method) click to toggle source

    # File lib/mail/configuration.rb, line 27
    def lookup_delivery_method(method)
      case method.is_a?(String) ? method.to_sym : method
      when nil
        Mail::SMTP
      when :smtp
        Mail::SMTP
      when :sendmail
        Mail::Sendmail
      when :exim
        Mail::Exim
      when :file
        Mail::FileDelivery
      when :smtp_connection
        Mail::SMTPConnection
      when :test
        Mail::TestMailer
      else
        method
      end
    end

lookup_retriever_method(method) click to toggle source

    # File lib/mail/configuration.rb, line 53
    def lookup_retriever_method(method)
      case method
      when nil
        Mail::POP3
      when :pop3
        Mail::POP3
      when :imap
        Mail::IMAP
      when :test
        Mail::TestRetriever
      else
        method
      end
    end

param_encode_language(value = nil) click to toggle source

    # File lib/mail/configuration.rb, line 68
    def param_encode_language(value = nil)
      value ? @encode_language = value : @encode_language ||= 'en'
    end

retriever_method(method = nil, settings = {}) click to toggle source

    # File lib/mail/configuration.rb, line 48
    def retriever_method(method = nil, settings = {})
      return @retriever_method if @retriever_method && method.nil?
      @retriever_method = lookup_retriever_method(method).new(settings)
    end