title: Connecting To Imap With PHP Being Refused
body: <p>I am having a problem connecting php code to an IMAP server.</p>
  
  <p>So as it goes I have a VPS with Godaddy and I also have a shared hosting account that has the email address I want to connect to. I also have a local virtual machine running CentOS 6 with LAMP.</p>
  
  <p>If I run my code on the Godaddy VPS, the imap connection works perfectly to the mailbox. As soon as I put the code on the local virtual machine it simply won't connect to the mail server:</p>
  
  <pre><code>Warning: imap_open(): Couldn't open stream {mailserverdomain.co.uk:143/imap/notls}INBOX in /var/www/html/getemail.php on line 25 Notice: Unknown: Can't connect to mailserverdomain.co.uk,143: Permission denied (errflg=2) in Unknown on line 0 
  </code></pre>
  
  <p>It is using exactly the same code, and exactly the same connection info that I use on the Godaddy VPS copy. So I don't understand why my local virtual machine won't connect to the mail server. I have iptables completely switched off on the local virtual machine.</p>
  
  <p>I'm getting "permission denied", even though it works fine on the Godaddy VPS. Obviously i have php imap installed on my local vm because the functions work...they just fail to connect to the external mail server.</p>
  
  <p>I get this error from imap_open</p>
  
  <p>Notice: Unknown: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN</p>
  
  <p>I don't get this running it from the Godaddy VPS, only from my internal virtual machine. It makes no sense!</p>
  
  <p>And here is the php connection code which works fine on the VPS but not my VM:</p>
  
  <pre><code>imap_open("{" . $emailServer . ":" . $emailPort . "/imap/notls}INBOX",$emailUser,$emailPass)
  </code></pre>