Class: ICFS::Email::From

Inherits:
Object
  • Object
show all
Defined in:
lib/icfs/email/from.rb

Overview

Note:

Only use this in conjunction with some form of email spoofing prevention.

Receive email user based on FROM: header

Instance Method Summary collapse

Constructor Details

#initialize(map) ⇒ From

New instance

Parameters:

  • map (Object)

    Maps email address to username



33
34
35
# File 'lib/icfs/email/from.rb', line 33

def initialize(map)
  @map = map
end

Instance Method Details

#receive(env) ⇒ Object

Extract the user based on the FROM: email.



41
42
43
44
45
46
# File 'lib/icfs/email/from.rb', line 41

def receive(env)
  email = env[:msg].from.first
  unam = @map[email]
  env[:user] = unam if unam
  return :continue
end