Module: Mack::Notifier::DeliveryHandlers::Sendmail

Defined in:
lib/mack-notifier/delivery_handlers/sendmail.rb

Overview

Delivers Mack::Notifier objects using sendmail.

Class Method Summary collapse

Class Method Details

.deliver(mail) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/mack-notifier/delivery_handlers/sendmail.rb', line 7

def self.deliver(mail)
  sendmail_settings = configatron.mack.notifier.sendmail
  sendmail_args = sendmail_settings.arguments
  sendmail_args += " -f \"#{mail.reply_to}\"" if mail.reply_to
  IO.popen("#{sendmail_settings.location} #{sendmail_args}","w+") do |sm|
    sm.print(mail.deliverable.gsub(/\r/, ''))
    sm.flush
  end
end