Sending e-mail

There are (at least) two approaches for sending e-mail in Windows: the Messaging Application Programming Interface (MAPI) and direct implementation of the Simple Mail Transfer Protocol. MAPI has some advantages, such as the ability to use its address book, but we decided not to use it because it may not be installed on all machines, and because recent Office security patches from Microsoft change MAPI so that user intervention is required before an application like GeekSecurity can actually send a message, something inappropriate for unattended operation.

SMTP is complex to implement, however, so rather than do that we used a nice class written by PJ Naughter. We didn’t need all the functionality of his class, though, and wanted to provide persistent storage of the addressing and server parameters.

All the other message parameters, including server, authentication, addressee, and sender, are maintained in the registry and configured via a dialog box. The constructor for the CEmailNotification class reads the registry, while the destructor writes changed values to those parameters back to the registry.