module Hippo::Mailer
Public Class Methods
create()
click to toggle source
# File lib/hippo/mailer.rb, line 17 def create config = SystemSettings.for_ext(:smtp) delivery_config = delivery_method_config(config) Mail::Message.new do from "\"#{config['from_name']}\" <#{config['from_email']}>" if Hippo.env.production? delivery_method :smtp, delivery_config else delivery_method TestMailer, delivery_config end end end
delivery_method_config(config)
click to toggle source
# File lib/hippo/mailer.rb, line 30 def delivery_method_config(config) Hippo::Tenant.system.perform do config = Hippo.config.secrets.smtp || {} { address: config['address'], user_name: config['user_name'], password: config['password'], enable_starttls_auto: true, port: 587 } end end
from_template(template)
click to toggle source
# File lib/hippo/mailer.rb, line 43 def from_template(template) mail = create mail.content_type = 'text/html; charset=UTF-8' mail.body = template.render mail.to = template.to mail.subject = template.subject mail end