I have an SMTP (postfix) server running on a centos server. Its working away fine with roundcube as the email client, but i want to integrate an email client with a website. I tried an iframe to roundcube and its not going to work out.
I can send emails fine using PHP and they are correctly ending up in gmail inboxes, but i cannot read any emails. Incoming emails are placed into "/home/{user}/maildir". Apache doesnt have the permissions to read the files in this directory. So this code wont work for me.
$messages = scandir($emailRootDir)
Since php is able to send emails via SMTP im assuming it also has the ability to get them. How can i query postfix and get the latest inbound emails. I have the code written to parse the email files, the only thing holding me back is actually getting the emails so i can parse them.
My last resort is to create a crontab that will just copy all of the emails to a directory that apache can access, but i would like to keep this entire solution within the php script so it can be easily transferred to another server if i ever need to.