I need a PHP script that will:
1. Use POP3 to check an email account and retrieve an HTML attachment from any email contained therein (must be able to process multiple emails)
2. Archive and then delete the email from the POP3 account
3. Convert the HTML file into a SQL insert statement (the data is in a table in the HTML file and could contain from 2 to 20 rows of data. The first row would be header data and would need to be discarded.
4. Execute the insert statement
5. Fire off an email in case of any kind of errors
Attached is the HTML file in question.