Class: MnoEnterprise::SmtpClient
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- MnoEnterprise::SmtpClient
- Defined in:
- lib/mno_enterprise/smtp_client.rb
Overview
Base class (instantiable) for SMTP adapter
Instance Method Summary collapse
-
#deliver(template, from, to, vars = {}, opts = {}) ⇒ Object
Send SMTP template - terminal mailing part.
-
#format_sender(from) ⇒ Object
Returns Actionmailer-compliant :from string.
-
#humanize(template_slug) ⇒ Object
Returns humanized template subject.
Instance Method Details
#deliver(template, from, to, vars = {}, opts = {}) ⇒ Object
Send SMTP template - terminal mailing part
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mno_enterprise/smtp_client.rb', line 7 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) ⇒ Object
Returns Actionmailer-compliant :from string
22 23 24 |
# File 'lib/mno_enterprise/smtp_client.rb', line 22 def format_sender(from) "#{from[:name]} <#{from[:email]}>" end |
#humanize(template_slug) ⇒ Object
Returns humanized template subject
28 29 30 |
# File 'lib/mno_enterprise/smtp_client.rb', line 28 def humanize(template_slug) template_slug.tr("-", "_").humanize end |