Class: MetaMailer::Elasticemail
- Inherits:
-
MetaMailer
- Object
- MetaMailer
- MetaMailer::Elasticemail
- Defined in:
- lib/elasticemailm.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) ⇒ Elasticemail
constructor
A new instance of Elasticemail.
- #send(from, to, subject, html, text) ⇒ Object
Methods inherited from MetaMailer
Constructor Details
#initialize(username, api_key) ⇒ Elasticemail
Returns a new instance of Elasticemail.
5 6 7 8 |
# File 'lib/elasticemailm.rb', line 5 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.
3 4 5 |
# File 'lib/elasticemailm.rb', line 3 def api_key @api_key end |
#username ⇒ Object
Returns the value of attribute username.
2 3 4 |
# File 'lib/elasticemailm.rb', line 2 def username @username end |
Instance Method Details
#send(from, to, subject, html, text) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/elasticemailm.rb', line 10 def send(from, to, subject, html, text) from_address = from.split("<")[1].split(">")[0] from_name = from.split(" <")[0] uri = URI("https://api.elasticemail.com/mailer/send") p = {:username => self.username, :api_key => self.api_key, :from => from_address, :from_name => from_name, :to => to, :subject => subject, :body_html => html, :body_text => text} response = send_secure(uri, p) end |