123456789_123456789_123456789_123456789_123456789_

Module: ActionMailer::DeliveryMethods

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: actionmailer/lib/action_mailer/delivery_methods.rb

Overview

This module handles everything related to mail delivery, from registering new delivery methods to configuring the mail object to be sent.

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

DSL Calls

included

[ GitHub ]


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'actionmailer/lib/action_mailer/delivery_methods.rb', line 13

included do
  # Do not make this inheritable, because we always want it to propagate
  cattr_accessor :raise_delivery_errors, default: true
  cattr_accessor :perform_deliveries, default: true

  class_attribute :delivery_methods, default: {}.freeze
  class_attribute :delivery_method, default: :smtp

  add_delivery_method :smtp, Mail::SMTP,
    address:              "localhost",
    port:                 25,
    domain:               "localhost.localdomain",
    user_name:            nil,
    password:             nil,
    authentication:       nil,
    enable_starttls_auto: true

  add_delivery_method :file, Mail::FileDelivery,
    location: defined?(Rails.root) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails"

  add_delivery_method :sendmail, Mail::Sendmail,
    location:  "/usr/sbin/sendmail",
    # See breaking change in the mail gem - https://github.com/mikel/mail/commit/7e1196bd29815a0901d7290c82a332c0959b163a
    arguments: Gem::Version.new(Mail::VERSION.version) >= Gem::Version.new("2.8.0") ? %w[-i] : "-i"

  add_delivery_method :test, Mail::TestMailer
end