Class: Hookworm::Emailer
- Inherits:
-
Object
- Object
- Hookworm::Emailer
- Defined in:
- lib/hookworm/emailer.rb
Instance Attribute Summary collapse
-
#email_uri ⇒ Object
readonly
Returns the value of attribute email_uri.
-
#helo ⇒ Object
readonly
Returns the value of attribute helo.
Instance Method Summary collapse
-
#initialize(email_uri, helo = 'localhost') ⇒ Emailer
constructor
A new instance of Emailer.
- #send_email(from, to, msg) ⇒ Object
Constructor Details
#initialize(email_uri, helo = 'localhost') ⇒ Emailer
Returns a new instance of Emailer.
8 9 10 11 |
# File 'lib/hookworm/emailer.rb', line 8 def initialize(email_uri, helo = 'localhost') @email_uri = URI(email_uri) @helo = helo end |
Instance Attribute Details
#email_uri ⇒ Object (readonly)
Returns the value of attribute email_uri.
6 7 8 |
# File 'lib/hookworm/emailer.rb', line 6 def email_uri @email_uri end |
#helo ⇒ Object (readonly)
Returns the value of attribute helo.
6 7 8 |
# File 'lib/hookworm/emailer.rb', line 6 def helo @helo end |
Instance Method Details
#send_email(from, to, msg) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/hookworm/emailer.rb', line 13 def send_email(from, to, msg) Net::SMTP.start(*smtp_args) do |smtp| smtp.enable_ssl if email_uri.scheme == 'smtps' smtp.(msg, from, to) end end |