Class: MetaMailer::Postageapp

Inherits:
MetaMailer show all
Defined in:
lib/postageappm.rb

Overview

PostageApp.configure do |config|

config.api_key = ""# api key goes here

end

Instance Method Summary collapse

Methods inherited from MetaMailer

#send_secure

Constructor Details

#initialize(api_key) ⇒ Postageapp

Returns a new instance of Postageapp.



9
10
11
12
13
# File 'lib/postageappm.rb', line 9

def initialize(api_key)
  PostageApp.configure do |config|
    config.api_key = ""
  end
end

Instance Method Details

#send(from, to, subject, html, text) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/postageappm.rb', line 15

def send(from, to, subject, html, text)
  request = PostageApp::Request.new(:send_message, {
    'headers' => {
      'from' => from,
      'subject' => subject,
    }, 
    'recipients' => to,
    'content' => {
      'text/plain'  => text,
      'text/html'  => html
    }
  })
  response = request.send
  response.ok?
end