class Mushy::EmailBase
Public Instance Methods
adjust(options)
click to toggle source
# File lib/mushy/fluxs/smtp.rb, line 25 def adjust options end
cleanup(options)
click to toggle source
# File lib/mushy/fluxs/smtp.rb, line 28 def cleanup options options.tap do |hash| hash.delete_if { |_, v| v.to_s == '' } end end
get_via_options_from(config)
click to toggle source
# File lib/mushy/fluxs/smtp.rb, line 34 def get_via_options_from config { address: config[:address], port: config[:port].to_s, user_name: config[:username], password: config[:password], domain: config[:domain], authentication: :plain, enable_starttls_auto: true, } end
process(event, config)
click to toggle source
# File lib/mushy/fluxs/smtp.rb, line 7 def process event, config options = adjust(cleanup({ from: config[:from], to: config[:to], subject: config[:subject], body: config[:body], html_body: config[:html_body], via_options: get_via_options_from(config) })) if (config[:attachment_file].to_s != '') options[:attachments] = { config[:attachment_file].split("\/")[-1] => File.read(config[:attachment_file]) } end result = Pony.mail options options.tap { |x| x.delete(:via_options) } end