Ok This is an alternative solution. Assuming there is no reason why you want to use emails (for example, your information comes from an external source via email), then I would suggest that the database table be a much simpler way to create an input queue.
Simple database polling on a regular basis. This would be much faster than polling an email inbox and much faster than you think. Database polling is very fast, and you can easily test a database table several hundred times per minute with very little impact on performance.
Just create a table to store your Q elements and add an extra field where you can save the timestamp or flag that was processed by this q element, then you just take the next raw element from the stack
e.g. MSSQL
select Top 1 * from tbl_MyQ where AlreadyHandled = 0
MySQL
select * from tbl_MyQ where AlreadyHandled = 0 Limit 1
then
update tbl_MyQ Set AlreadyHandled = 1 where QueueID =
Databases are fast, run a test if you are worried. And they are much less complex than IMAP events and email mailboxes.
source share