code: def get_mail_addresses(message, header_name):
      
      headers = [h for h in message.get_all(header_name, [])]
      addresses = email.utils.getaddresses(headers)
  
      for index, (address_name, address_email) in enumerate(addresses):
          addresses[index] = {'name': decode_mail_header(address_name),
                              'email': address_email}
          logger.debug("{} Mail address in message: <{}> {}".format(
              header_name.upper(), address_name, address_email))
      return addresses
docs: Retrieve all email addresses from one message header.