title: IMAP open stream: Self signed certificate issue
body: <p>I'm trying to open the non-secure (port 143) IMAP connection (I am using PHP):</p>
  
  <pre><code>imap_open('{localhost:143/imap}INBOX', USERNAME, PASS);
  </code></pre>
  
  <p>and I get the next error: <code>Certificate failure for localhost: self signed certificate ...</code></p>
  
  <p>Ok. I've tried to use <code>/novalidate-cert</code> mailbox param. Then I get another error: <code>Can not authenticate to IMAP server</code>.</p>
  
  <p>I've also tried to combine all possible non-secure connection params like <code>/notls</code>,<code>/norsh</code> and <code>/secure</code>. But I always get errors.</p>
  
  <p>This is the Dovecot configuration I'm using:</p>
  
  <p><code>* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=LOGIN] Dovecot ready.</code></p>
  
  <p>The certificate is really self-signed and generated with openssl.</p>
  
  <p>The questions are:</p>
  
  <ol>
  <li>Why does the certificate error occurs when I am using non-secure connection?</li>
  <li>What is wrong with the mail server configuration?</li>
  </ol>