class Autoreply::Scanner::MicrosoftOutlook

Constants

OUT_OF_OFFICE_PHRASES_REGEXPS

Public Instance Methods

autoreply?() click to toggle source
# File lib/autoreply/scanner/microsoft_outlook.rb, line 8
def autoreply?
  outlook_x_mailer_header? && contains_out_of_office_phrase?
end

Private Instance Methods

contains_out_of_office_phrase?() click to toggle source
# File lib/autoreply/scanner/microsoft_outlook.rb, line 20
def contains_out_of_office_phrase?
  result = OUT_OF_OFFICE_PHRASES_REGEXPS.inject([]) do |result, regexp|
    result << regexp if mail.body.to_s =~ regexp
    result
  end

  !result.empty?
end
outlook_x_mailer_header?() click to toggle source
# File lib/autoreply/scanner/microsoft_outlook.rb, line 14
def outlook_x_mailer_header?
  return false if x_mailer_header.nil?

  x_mailer_header.value =~ /((M|m)icrosoft\s)?(O|o)utlook/
end
x_mailer_header() click to toggle source
# File lib/autoreply/scanner/microsoft_outlook.rb, line 29
def x_mailer_header
  mail.header_fields.detect {|header| header.name == "x-mailer" }
end