class Inkcite::Mailer::SmtpMailer

Public Class Methods

new(config) click to toggle source
Calls superclass method Inkcite::Mailer::Base::new
# File lib/inkcite/mailer.rb, line 267
def initialize config
  super(config)
end

Public Instance Methods

send!(recipients, subject, content) click to toggle source
# File lib/inkcite/mailer.rb, line 271
def send! recipients, subject, content

  _config = config

  Mail.defaults do
    delivery_method :smtp, {
            :address => _config[:host],
            :port => _config[:port],
            :user_name => _config[:username],
            :password => _config[:password],
            :authentication => :plain,
            :enable_starttls_auto => true
        }
  end

  mail = Mail.new do
    html_part do
      content_type 'text/html; charset=UTF-8'
      body content
    end
  end

  mail[:to] = recipients[:to]
  mail[:cc] = recipients[:cc]
  mail[:bcc] = recipients[:bcc]
  mail[:from] = get_from_address
  mail[:subject] = subject

  mail.deliver!

end