Class: Alert_Email
- Inherits:
-
Object
- Object
- Alert_Email
- Defined in:
- lib/Alert/Email.rb
Instance Method Summary collapse
-
#initialize(destination, body) ⇒ Alert_Email
constructor
A new instance of Alert_Email.
- #Send ⇒ Object
Constructor Details
#initialize(destination, body) ⇒ Alert_Email
Returns a new instance of Alert_Email.
5 6 7 8 |
# File 'lib/Alert/Email.rb', line 5 def initialize( destination, body ) @destination = destination @body = body end |
Instance Method Details
#Send ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/Alert/Email.rb', line 10 def Send = <<MESSAGE_END From: Agrimetrics <[email protected]> To: #{@destination} Subject: Agrimetrics Alert #{@body} . MESSAGE_END Net::SMTP.start('localhost') do |smtp| smtp. , '[email protected]', @destination end rescue Errno::ECONNREFUSED => e puts "*** Conection refused while attempting to connect to SMTP server" puts "*** Recipient, #{@destination}. Body," puts "*** #{@body}" end |