Class: MailRoom::Delivery::LetterOpener

Inherits:
Object
  • Object
show all
Defined in:
lib/mail_room/delivery/letter_opener.rb

Overview

LetterOpener Delivery method

Author:

  • Tony Pitale

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(delivery_options) ⇒ LetterOpener

Build a new delivery, hold the delivery options


20
21
22
# File 'lib/mail_room/delivery/letter_opener.rb', line 20

def initialize(delivery_options)
  @delivery_options = delivery_options
end

Instance Method Details

#deliver(message) ⇒ Object

Trigger `LetterOpener` to deliver our message

Parameters:

  • message (String)

    the email message as a string, RFC822 format


26
27
28
29
30
31
# File 'lib/mail_room/delivery/letter_opener.rb', line 26

def deliver(message)
  method = ::LetterOpener::DeliveryMethod.new(:location => @delivery_options.location)
  method.deliver!(Mail.read_from_string(message))

  true
end