Class: MetaMailer::Mailgun
- Inherits:
-
MetaMailer
- Object
- MetaMailer
- MetaMailer::Mailgun
- Defined in:
- lib/mailgunm.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(username, api_key) ⇒ Mailgun
constructor
A new instance of Mailgun.
- #send(from, to, subject, html, text) ⇒ Object
Methods inherited from MetaMailer
Constructor Details
#initialize(username, api_key) ⇒ Mailgun
Returns a new instance of Mailgun.
8 9 10 11 |
# File 'lib/mailgunm.rb', line 8 def initialize(username, api_key) @username = username @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/mailgunm.rb', line 6 def api_key @api_key end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/mailgunm.rb', line 5 def username @username end |
Instance Method Details
#send(from, to, subject, html, text) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mailgunm.rb', line 13 def send(from, to, subject, html, text) data = Multimap.new data[:from] = from data[:to] = to data[:subject] = subject data[:text] = text data[:html] = html RestClient.post "https://api:#{@api_key}"\ "@api.mailgun.net/v2/#{@username}.mailgun.org/messages", data end |