class MnoEnterprise::SmtpClient

Base class (instantiable) for SMTP adapter

Public Instance Methods

deliver(template, from, to, vars={}, opts={}) click to toggle source

Send SMTP template - terminal mailing part

# File lib/mno_enterprise/smtp_client.rb, line 9
def deliver(template, from, to, vars={}, opts={})
  @info = vars
  @info[:company] = from[:name]

  mail(
    from: format_sender(from),
    to: to[:email],
    subject: humanize(template),
    template_path: 'system_notifications',
    template_name: template
  )
end
format_sender(from) click to toggle source

Returns Actionmailer-compliant :from string @Format : “Sender name <sender@email.com>”

# File lib/mno_enterprise/smtp_client.rb, line 24
def format_sender(from)
  "#{from[:name]} <#{from[:email]}>"
end
humanize(template_slug) click to toggle source

Returns humanized template subject @i.e. “reset-password-instructions” to “Reset password instructions”

# File lib/mno_enterprise/smtp_client.rb, line 30
def humanize(template_slug)
  template_slug.tr("-", "_").humanize
end