I have the following code working in PHP 7, i use it to save my mail inbox into my db.
$hostname = \'{imap.gmail.com:993/imap/ssl/novalidate-cert}\'; $username =