I currently have the need to set up an outgoing SMTP server with an extra twist to it. If a user sends an email and this server receives the mail then it should validate the the email address that the message was sent from to a SQL database.
i.e: I have a table with email addresses and a status column for ACTIVE/INACTIVE. A user sends an email and it gets sent to the SMTP server. When the email is received by the SMTP server, the server should take the email address that the mail has been sent from and validate it against the database to check the email address's corresponding status. If that status is active then the message should relay to the to address. If not, a reply message should be sent to that email address stating that the email is inactive.
My question is thus. Will it be best to write my own SMTP server app in C# that does this or is there a sort of an out of the box solution such as IIS that I can set up some how to get this functionality?
Re-writing my own email server app in C# seems like a dirty solution and a recreation of the wheel?
I read something about OnArrival functionality on an IIS SMTP server that can take scripts. Any thoughts on that?