Class: Eye::Notify::Mail
Constant Summary
Constants inherited
from Eye::Notify
TIMEOUT, TYPES
Instance Method Summary
collapse
Methods inherited from Eye::Notify
#async_notify, depends_on, get_class, #initialize, #logger_sub_tag, #message_body, #message_subject, #notify, notify, register, validate!
included
Constructor Details
This class inherits a constructor from Eye::Notify
Instance Method Details
21
22
23
|
# File 'lib/eye/notify/mail.rb', line 21
def execute
smtp
end
|
34
35
36
37
38
39
40
41
42
|
# File 'lib/eye/notify/mail.rb', line 34
def message
h = []
h << "From: #{from_name} <#{from_mail || user}>" if from_mail || user
h << "To: <#{contact}>"
h << "Subject: #{message_subject}"
h << "Date: #{msg_at.httpdate}"
h << "Message-Id: <#{rand(1000000000).to_s(36)}.#{$$}.#{contact}>"
"#{h * "\n"}\n#{message_body}"
end
|
25
26
27
28
29
30
31
32
|
# File 'lib/eye/notify/mail.rb', line 25
def smtp
args = [host, port, domain, user, password, auth]
debug "called smtp with #{args}"
Net::SMTP.start(*args) do |smtp|
smtp.send_message(message, from_mail || user, contact)
end
end
|