class Eye::Notify::Mail

Public Instance Methods

execute() click to toggle source
# File lib/eye/notify/mail.rb, line 23
def execute
  smtp
end
message() click to toggle source
# File lib/eye/notify/mail.rb, line 38
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(1_000_000_000).to_s(36)}.#{$$}.#{contact}>"
  "#{h * "\n"}\n#{message_body}"
end
smtp() click to toggle source
# File lib/eye/notify/mail.rb, line 27
def smtp
  args = [host, port, domain, user, password, auth]
  debug { "called smtp with #{args}" }
  smtp = Net::SMTP.new host, port
  smtp.enable_starttls if starttls

  smtp.start(domain, user, password, auth) do |s|
    s.send_message(message, from_mail || user, contact)
  end
end