Class: Card::Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/card/mailer.rb

Class Method Summary collapse

Class Method Details

.defaults_from_configObject



31
32
33
34
35
36
# File 'lib/card/mailer.rb', line 31

def defaults_from_config
  (Card.config.email_defaults || {}).symbolize_keys.tap do |defaults|
    defaults[:return_path] ||= defaults[:from] if defaults[:from]
    defaults[:charset] ||= "utf-8"
  end
end

.layout(message) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/card/mailer.rb', line 17

def layout message
  <<-HTML
    <!DOCTYPE html>
    <html>
      <head>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
      </head>
      <body>
        #{message}
      </body>
    </html>
  HTML
end

.new_mail(*args, &block) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/card/mailer.rb', line 8

def new_mail *args, &block
  Mail.new(args, &block).tap do |mail|
    method = Card::Mailer.delivery_method
    mail.delivery_method(method, send(:"#{method}_settings"))
    mail.perform_deliveries    = perform_deliveries
    mail.raise_delivery_errors = raise_delivery_errors
  end
end