Class: StatusChecker::Email
- Inherits:
-
Object
- Object
- StatusChecker::Email
- Defined in:
- lib/status_checker/email.rb
Instance Method Summary collapse
-
#initialize(receivers) ⇒ Email
constructor
A new instance of Email.
- #send(url, response) ⇒ Object
Constructor Details
#initialize(receivers) ⇒ Email
Returns a new instance of Email.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/status_checker/email.rb', line 6 def initialize(receivers) raise ArgumentError, "receivers can't be empty" if receivers.empty? @receivers = receivers @addres = 'smtp.mail.ru' @port = 465 @domain = 'mail.ru' @authentication = :plain @user_name = '[email protected]' @password = 'qwerty123456' @smtp = Net::SMTP.new(@addres, @port) @smtp.enable_tls end |
Instance Method Details
#send(url, response) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/status_checker/email.rb', line 19 def send(url, response) begin @smtp.start(@domain, @user_name, @password, @authentication) @receivers.each do |email| @smtp. (url, response, email), @user_name, email end ensure @smtp.finish end end |