title: Read email imap php
body: <p>I am using PHP - Codeigniter (Peeker Library) as back-end  and using IMAP to fetch emails from multiple email addresses.</p>
  
  <p>We have some complex search criteria to query against imap folder, to increase performance of the script we only search on new emails and storing mailbox name,unique id (unique in mailbox), some header information in MySQL table. </p>
  
  <p>I came up with two problems :</p>
  
  <ol>
  <li>How can i keep track on <code>Deleted / Moved</code> items ? </li>
  <li>Is there any way to determine attachment exists or not ? ( Because header information doesn't give any clue to attachment indicator , i tried to use <code>imap_fetchstructure</code> but it reads the entire message including attachment which takes a long time to process )</li>
  </ol>
  
  <p><strong>Note :</strong></p>
  
  <blockquote>
    <p>I am running this script on back end with a regular interval ( But not
     a cron job, an external application will initialize the script on a regular
    interval ).Additionally i am doing all these with PHP with its on limitations.</p>
  </blockquote>
  
  <p>Please help me.</p>
  
  <p>Thanks</p>