title: Get email headers from GMail's "Sent items" folder
body: <p>My program sends emails to contacts via GMail. Normally this works very well but we have noticed that sometimes an email which my program "thinks" it has sent doesn't actually arrive at Gmail, let alone arrive at the contacts. I thought that I might be able to add to the program a check which accesses the Gmail "sent items" folder to see whether each email has indeed been sent.</p>
  
  <p>I have some code using the TIdPOP3 component but this downloads headers from the Inbox, not from sent items. My question is, how can I access the headers in the sent items folder?</p>
  
  <p>Following is the code that I am using. It's only test code so there aren't any try/finally blocks, etc.</p>
  
  <pre><code> with pop do
    begin
     host:= 'pop.gmail.com';
     username:= 'someone@gmail.com';
     password:= .....;
     Port:= 995;
     Connect;
     if connected then 
      with i:= checkmessages downto 1 do
       begin
        msg.clear;   // msg is of type TIdMessage
        if retrieve (i, msg)
         then listbox1.items.add (msg.subject)
       end;
     disconnect
    end;
  </code></pre>