Hi there,
The intention is rather clear, intercept the email received and save it to database table. However, that note, "sent to script through cpanel directive", is a little bit confusing. I thought the script will listen a certain email box through imap and process any incoming email appropriately. Is there some sort of a trigger on your cpanel which will invoke the script with the email data or am I missing something here?
I am planning to use php7.2. Please let me know if you want me to target another version. If you have already created that db schema it'd be helpful if you send it before I start, thanks.