class MailHandler::Receiving::Notification::EmailContent

email notification sent

Public Instance Methods

retrieve(type, options, delay, from, to) click to toggle source

@param [Symbol] type - notification type @param [Hash] options - search options used for searching for an email @param [Int] delay - delay in seconds @param [String] from - email address @param [String] to - email address

# File lib/mailhandler/receiving/notification/email/content.rb, line 15
def retrieve(type, options, delay, from, to)
  mail = Mail.new
  mail.from = from
  mail.to = to
  delay = (delay.to_f / 60).round(2)

  case type
  when :received
    mail.subject = "Received - delay was #{delay} minutes"
    mail.body = "Received - delay was #{delay} minutes - search by #{options}"

  when :delayed
    mail.subject = "Over #{delay} minutes delay"
    mail.body = "Over #{delay} minutes delay - search by #{options}"

  else
    raise StandardError, "Incorrect type: #{type}"

  end

  mail
end