# File lib/larch/imap/mailbox.rb, line 135
  def fetch(guid, peek = false)
    scan

    unless db_message = fetch_db_message(guid)
      warning "message not found in local db: #{guid}"
      return nil
    end

    debug "#{peek ? 'peeking at' : 'fetching'} message: #{guid}"

    imap_uid_fetch([db_message.uid], [(peek ? 'BODY.PEEK[]' : 'BODY[]'), 'FLAGS', 'INTERNALDATE', 'ENVELOPE']) do |fetch_data|
      data = fetch_data.first
      check_response_fields(data, 'BODY[]', 'FLAGS', 'INTERNALDATE', 'ENVELOPE')

      return Message.new(guid, data.attr['ENVELOPE'], data.attr['BODY[]'],
          data.attr['FLAGS'], Time.parse(data.attr['INTERNALDATE']))
    end

    warning "message not found on server: #{guid}"
    return nil
  end