A program written in unmanaged C++ that compiles in Visual Studio 2008, that can be executed at the command prompt, that:
1. Listens on port 25 for incoming SMTP messages, in a multithreaded way so multiple simultaneous connections are supported
2. Accepts any SMTP message and saves them to disk as .eml plaintext SMTP message files, using a filename YYYYMMDDHHMMSSRR where YYYY = year, MM = month, DD = date, RR = random letters and numbers to avoid duplication in the filename. This should be saved to the "incoming" subdirectory under the program folder, which should be automatically created if it does not already exist.
3. Display "Press any key to exit" and upon detecting a keystroke, gracefully exit from the program.
This should be written so the functionality is encapsulated in a C++ Class, which is instantiated and called by the main program. The class should have an Abort() function which is called by the main program, to cause any open TCP connections to get terminated, and gracefully exit from any running threads, which then allows the main program to exit to the command prompt without any remaining threads. This is part of a larger project, so the functionality should be encapsulated cleanly in an object-oriented fashion.