module Mailer

Attributes

config[R]

Public Class Methods

send(to, subject, body) click to toggle source
# File lib/mailer.rb, line 26
def self.send to, subject, body
  from = config[:user_name]
  Mail.deliver do
    to to
    from from
    subject subject
    body body
  end
end
setup() { |config| ... } click to toggle source
# File lib/mailer.rb, line 9
def self.setup
  @config ||= {      
    address: '',
    port: 587,
    user_name: '',
    password: '',
    enable_starttls_auto: true
  }

  yield(config)

  opt = @config
  Mail.defaults do      
    delivery_method :smtp, opt
  end
end