Fast and Simple Email from Inhouse Applications

\[Editor's Note: Email your Exchange Server and Outlook solutions (400 words maximum) to R2R at knicholson@win2000mag.com. Please include your phone number. We edit submissions for style, grammar, and length. If we print your contribution, you'll get $100.\]

When we needed a fast and simple way to automate email from our database front-end applications that we developed inhouse, I looked everywhere for solutions. Except for creating a custom Messaging API (MAPI) DLL with C++ (a solution that went well beyond "fast and simple"), sending automated email from our database applications seemed impossible. Then, I remembered that Exchange Server 5.5 has a pickup directory. When users save plaintext ASCII files in the Request for Comments (RFC) 822 format and place them in the pickup directory, Exchange automatically processes the files and sends them as email.

The pickup directory is part of the Internet Mail Service (IMS). The directory is a subfolder under the \%exchsrvr%\imcdata folder. You must install and configure the IMS before the pickup folder will work. In addition, I created a share name (pickup) for this directory so users could access it directly by a Uniform Naming Convention (UNC) name (i.e., \\exch01\pickup).

Finally, I set permissions on this directory so that only Authenticated Users could write to it. Be careful when setting these permissions. The IMS must be able to delete any files in the pickup folder, otherwise it won't send the email message. This capability prevents the IMS from sending the same message more than once.

When you've set up the directory properly, you can write applications. Simply create and save RFC 822 ASCII text files into the pickup folder for delivery. Figure 1 is an example of a properly formatted RFC 822 ASCII text file. The bold text is information that you can automatically derive from a combination of the OS (e.g., date and time) and database records (e.g., usernames, email addresses, problem report numbers).