title: Imap count all mails of email account
body: <p>I'm trying to count all emails from and email but my script only count mails from inbox, </p>
  
  <p>anyone know how to count all emails from the mail account including sent,spam,deleted, etc</p>
  
  <pre><code>$mailcnf = "mail.office365.com:993/imap/ssl/novalidate-cert";
  $conn_str = "{".$mailcnf."}INBOX";
  
  
  $username = 'test3@sjnewman.co.uk';
  $password = 'Woju6532';
  $imap = imap_open($conn_str,$username,$password) or die('Cannot connect to Server: ' . imap_last_error());
  
  echo $message_count = imap_num_msg($imap);
  </code></pre>