Class: Mapi::Recipient

Inherits:
Item
  • Object
show all
Defined in:
lib/mapi/base.rb

Direct Known Subclasses

Msg::Recipient, Pst::Recipient

Constant Summary collapse

RECIPIENT_TYPES =
{ 0 => :orig, 1 => :to, 2 => :cc, 3 => :bcc }

Instance Attribute Summary

Attributes inherited from Item

#properties

Instance Method Summary collapse

Methods inherited from Item

#initialize

Constructor Details

This class inherits a constructor from Mapi::Item

Instance Method Details

#emailObject



56
57
58
# File 'lib/mapi/base.rb', line 56

def email
  props.smtp_address || props.org_email_addr || props.email_address
end

#inspectObject



73
74
75
# File 'lib/mapi/base.rb', line 73

def inspect
  "#<#{self.class.to_s[/\w+$/]}:#{self.to_s.inspect}>"
end

#nameObject

some kind of best effort guess for converting to standard mime style format. there are some rules for encoding non 7bit stuff in mail headers. should obey that here, as these strings could be unicode email_address will be an EX:/ address (X.400?), unless external recipient. the other two we try first. consider using entry id for this too.



50
51
52
53
54
# File 'lib/mapi/base.rb', line 50

def name
  name = props.transmittable_display_name || props.display_name
  # dequote
  name[/^'(.*)'/, 1] or name rescue nil
end

#to_sObject



65
66
67
68
69
70
71
# File 'lib/mapi/base.rb', line 65

def to_s
  if name = self.name and !name.empty? and email && name != email
    %{"#{name}" <#{email}>}
  else
    email || name
  end
end

#typeObject



61
62
63
# File 'lib/mapi/base.rb', line 61

def type
  RECIPIENT_TYPES[props.recipient_type]
end