Class: Mail::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mailbox/mail_ext/addresses.rb,
lib/action_mailbox/mail_ext/recipients.rb

Instance Method Summary collapse

Instance Method Details

#bcc_addressesObject



21
22
23
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 21

def bcc_addresses
  Array(address_list(header[:bcc])&.addresses)
end

#cc_addressesObject



17
18
19
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 17

def cc_addresses
  Array(address_list(header[:cc])&.addresses)
end

#from_addressObject



5
6
7
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 5

def from_address
  address_list(header[:from])&.addresses&.first
end

#recipientsObject



5
6
7
# File 'lib/action_mailbox/mail_ext/recipients.rb', line 5

def recipients
  Array(to) + Array(cc) + Array(bcc) + Array(header[:x_original_to]).map(&:to_s)
end

#recipients_addressesObject



9
10
11
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 9

def recipients_addresses
  to_addresses + cc_addresses + bcc_addresses + x_original_to_addresses
end

#to_addressesObject



13
14
15
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 13

def to_addresses
  Array(address_list(header[:to])&.addresses)
end

#x_original_to_addressesObject



25
26
27
# File 'lib/action_mailbox/mail_ext/addresses.rb', line 25

def x_original_to_addresses
  Array(header[:x_original_to]).collect { |header| Mail::Address.new header.to_s }
end