Class: MetaMailer::Sendgrid
- Inherits:
-
MetaMailer
- Object
- MetaMailer
- MetaMailer::Sendgrid
- Defined in:
- lib/sendgridm.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_user ⇒ Object
Returns the value of attribute api_user.
Instance Method Summary collapse
-
#initialize(api_user, api_key) ⇒ Sendgrid
constructor
A new instance of Sendgrid.
- #send(from, to, subject, html, text) ⇒ Object
Methods inherited from MetaMailer
Constructor Details
#initialize(api_user, api_key) ⇒ Sendgrid
Returns a new instance of Sendgrid.
7 8 9 10 |
# File 'lib/sendgridm.rb', line 7 def initialize(api_user, api_key) @username = @api_user @password = @api_key end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/sendgridm.rb', line 5 def api_key @api_key end |
#api_user ⇒ Object
Returns the value of attribute api_user.
4 5 6 |
# File 'lib/sendgridm.rb', line 4 def api_user @api_user end |
Instance Method Details
#send(from, to, subject, html, text) ⇒ Object
12 13 14 15 16 |
# File 'lib/sendgridm.rb', line 12 def send(from, to, subject, html, text) from_address = from.split("<")[1].split(">")[0] from_name = from.split(" <")[0] SendgridToolkit::Mail.new(@api_user, @api_key).send_mail :to => to, :from => from_address, :subject => subject, :text => text end |