Module: PostmarkRails::TemplatedMailerMixin::ClassMethods

Defined in:
lib/postmark-rails/templated_mailer.rb

Instance Method Summary collapse

Instance Method Details

#default(headers = {}) ⇒ Object



38
39
40
# File 'lib/postmark-rails/templated_mailer.rb', line 38

def default(headers = {})
  super(safe_headers(headers))
end

#safe_headers(headers = {}) ⇒ Object

Raises:

  • (ArgumentError)


42
43
44
45
46
47
# File 'lib/postmark-rails/templated_mailer.rb', line 42

def safe_headers(headers = {})
  headers = ActiveSupport::HashWithIndifferentAccess.new(headers)
  violation = READ_ONLY_HEADERS.find { |h| headers.key?(h) }
  raise ArgumentError, "Overriding '#{violation}' header in a templated mailer is not allowed." if violation
  headers
end