class ICFS::Email::From

Receive email user based on FROM: header

@note Only use this in conjunction with some form of email spoofing

prevention.

Public Class Methods

new(map) click to toggle source

New instance

@param map [Object] Maps email address to username

# File lib/icfs/email/from.rb, line 33
def initialize(map)
  @map = map
end

Public Instance Methods

receive(env) click to toggle source

Extract the user based on the FROM: email.

# 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