Module: Ditty::Services::Email

Extended by:
ActiveSupport::Inflector
Defined in:
lib/ditty/services/email.rb

Class Method Summary collapse

Class Method Details

.config!Object



14
15
16
17
18
19
# File 'lib/ditty/services/email.rb', line 14

def config!
  cfg = config
  Mail.defaults do
    delivery_method cfg[:delivery_method].to_sym, (cfg[:options] || {})
  end
end

.deliver(email, to = nil, options = {}) ⇒ Object



21
22
23
24
25
26
# File 'lib/ditty/services/email.rb', line 21

def deliver(email, to = nil, options = {})
  config!
  options[:to] ||= to unless to.nil?
  email = from_symbol(email, options) if email.is_a? Symbol
  email.deliver!
end