title: How to read the Content Type header and convert into utf-8 while Gmail IMAP has utf8 and Outlook has ISO-8859-7?
body: <p>So I get emails using imap from gmail and outlook.</p>
  
  <p>Gmail encodes like this <code>=?UTF-8?B?UmU6IM69zq3OvyDOtc68zrHOuc67IG5ldyBlbWFpbA==?=</code>
  and outlook encodes like this <code>=?iso-8859-7?B?UmU6IOXr6+ft6er8IHN1YmplY3Q=?=</code></p>
  
  <p>Unfortunately I did not find yet any solution that will help me make this into readable text. Instead I am messing with:</p>
  
  <pre><code>mb_convert_encoding($body, "UTF-8", "UTF-8"); 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>mb_convert_encoding($body, "UTF-8", "iso-8859-7");
  </code></pre>
  
  <p>but I am struggling to find a solution to solve this matter.</p>
  
  <p>This is how I open the IMAP of my account (which has a lot of gmail and outlook messages)</p>
  
  <pre><code>$hostname = '{imappro.zoho.com:993/imap/ssl}INBOX';
  $username = 'email@email.com';
  $password = 'password';
  
  
  /* try to connect */
  $inbox = imap_open($hostname,$username ,$password) or die('Cannot connect to Zoho: ' . imap_last_error());
  
  /* grab emails */
  $emails = imap_search($inbox,'UNSEEN');
  </code></pre>
  
  <p>Any help?</p>