    # File lib/vmail/contacts_extractor.rb, line 18
      def extract(limit = 500)
        open do |imap|
          set_mailbox_prefix
          mailbox = "[#@prefix]/Sent Mail"
          STDERR.puts "selecting #{mailbox}"
          imap.select(mailbox)
          STDERR.puts "fetching last #{limit} sent messages"
          all_uids = imap.uid_search('ALL')
          STDERR.puts "total messages: #{all_uids.size}"
          limit = [limit, all_uids.size].min
          STDERR.puts "extracting addresses from #{limit} of them"
          uids = all_uids[-limit ,limit]
          imap.uid_fetch(uids, ["FLAGS", "ENVELOPE"]).each do |fetch_data|
            recipients = fetch_data.attr["ENVELOPE"].to
            next unless recipients
            recipients.each do |address_struct|
              email = [address_struct.mailbox, address_struct.host].join('@')
              name = address_struct.name
              if name
                name = Mail::Encodings.unquote_and_convert_to(name, 'UTF-8')
                yield %Q("#{name}" <#{email}>)
              else
                yield email
              end
            end
          end
        end
      end