maybe it is a dummy question and there exists better approaches, but I wonder if there is any possibility of catching an event on incoming email using server side script and inside that script would be external DLL call or script which connect to database and writes some metadata from incoming message (same as external DLL would)?
The scenario could be:
Goal: to have instant information about all emails containing from, to, subject, message perex(first 100 chars), attachments flag and read flag accessible through SQL query without having to connect to IMAP or PO3. So using one SQL query I can get all notifications for all accounts and send them through signalR.
I realised that in MS SQL database of hmailserver is table called hm_messages which is automatically filled when email arrives but contains no subject, mostly no sender and definitely no body and attachment count. Row in that table contains only information about account, folder, flags, dates and name of *.eml file. I could write a trigger with SQLCLR function which could do the same as mentioned above but even if I have *.eml file name I do not have its actual location on the hard drive. So I am back to square one.
Otherwise I have to download messages from all accounts in a time loop, which is stealing my server CPU and memory especially where there is about 60 email accounts and thousands of messages in them and have to iterate them all over.
hMailServer
supports scripting in VBScript/JScript and supplies events to indicate new message arrival.
Both scripting languages support COM so can use for example ADO to connect to a database or can interoperate with a (late bound) COM Visible .Net assembly.
So yes, it can do what you ask but I would think carefully about the scalability of doing this