title: Getting unique email id with IMAP in PHP
body: <p>How can I calculate a unique id string for each email in an IMAP account?</p>
  
  <p>I am making a script which must frequently copy all missing mails from one IMAP account to another one. I want to avoid making duplicates on each update, so I have to identify what is on one account and what is on the other.</p>
  
  <p>Not all emails have a <code>message_id</code>, and I can't see what the difference between <code>message_id</code> and <code>uid</code> is - can anybody tell me?</p>
  
  <p>It seems to me that the <code>message_id</code> is not changed when using <a href="http://www.php.net/manual/en/function.imap-append.php" rel="noreferrer">imap_append</a> - can anybody confirm that?</p>
  
  <p>When generating a unique id string for each email there is many other options than just the message id, fx email title and date, but I don't know what to pick:
  <a href="http://www.php.net/manual/en/function.imap-headerinfo.php" rel="noreferrer">http://www.php.net/manual/en/function.imap-headerinfo.php</a></p>