Class: Email

Inherits:
MLS::Model show all
Defined in:
lib/mls/models/email.rb

Instance Method Summary collapse

Instance Method Details

#bccObject



31
32
33
# File 'lib/mls/models/email.rb', line 31

def bcc
  bcc_names.zip(bcc_addresses).map{|t| t[0] ? "\"#{t[0]}\" <#{t[1]}>" : t[1] }.join(', ')
end

#ccObject



27
28
29
# File 'lib/mls/models/email.rb', line 27

def cc
  cc_names.zip(cc_addresses).map{|t| t[0] ? "\"#{t[0]}\" <#{t[1]}>" : t[1] }.join(', ')
end

#fromObject



7
8
9
10
11
12
13
# File 'lib/mls/models/email.rb', line 7

def from
  if from_name
    "\"#{from_name}\" <#{from_address}>"
  else
    from_address
  end
end

#multipart?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/mls/models/email.rb', line 39

def multipart?
  body.keys.size > 1
end

#nameObject



15
16
17
# File 'lib/mls/models/email.rb', line 15

def name
  from_address || from
end

#partsObject



43
44
45
# File 'lib/mls/models/email.rb', line 43

def parts
  body.keys
end

#reply_toObject



35
36
37
# File 'lib/mls/models/email.rb', line 35

def reply_to
  reply_to_names.zip(reply_to_addresses).map{|t| t[0] ? "\"#{t[0]}\" <#{t[1]}>" : t[1] }.join(', ')
end

#senderObject



23
24
25
# File 'lib/mls/models/email.rb', line 23

def sender
  headers['Sender']
end

#toObject



19
20
21
# File 'lib/mls/models/email.rb', line 19

def to
  to_names.zip(to_addresses).map{|t| t[0] ? "\"#{t[0]}\" <#{t[1]}>" : t[1] }.join(', ')
end