There are any number of ways to send mail from dBASE Plus applets. Commercial OCXs, DLLs, and the ubiquitous SendMail, are available as free (or almost free) downloads from the Web. Any of these will work with dBASE Plus, so long as they don't require, or spawn, any GUI screens.

Most of them, however, generate consequences that can be unfortunate, impinging on the performance or reliability of your dBASE Plus application. It should be obvious that the less you do during the execution of an applet, the faster it finishes. As a corrollary to that, the sooner your applet finishes, the less connection time per user, the greater number of users that can access your site before exhausting your resources. To state it simply - The smaller and more efficient your dBASE Plus applets are, the better the performance and scalability.

We all know, from personal experience, that the performance of eMail servers is quite a bit less than instantaneous. That's almost entirely the result of traffic, and therefore  unpredictable and outside of your control. It makes no sence to build superfast dBASE Plus applets that slowed to a crawl when they had to access a busy eMail server. As a result, the best mail solutions are ones designed to run outside of the applet. That way, the application still gives the performance and resulting scalability that makes dBASE Plus so good on the Web. The eMail operation can crawl at its own pace, entirely divorced from anything going on between the browser, the Web server and the dBASE Plus applet.

There are two solutions that work really well:

Text File Interface

Bowen Moursund, the dBASE Inc. Online Manager wrote CGIIISMailClass.cc, a custom class that uses the built-in NT mail capabilities to send mail from dBASE Plus apps. That's the interface he's currently using to send eMail confirmations to customers and orders back to Corporate Headquarters from our Online Store.

It's by far the easiest way to send mail from a dBASE Plus mail applet. Just drop a properly formatted text file in the appropriate folder and Internet Information Server sends the mail for you.

Bowen's class, mailCGISession subclasses CGISession and adds Windows NT eMail capabilities.

Usage:

Try  // Always use a try...catch

  #define CRLF chr(13)+chr(10)  // Define Carriage Return/linefeed

  // Create new mailCGISession object

  // Pass the full Windows path to the pickup

  // folder as a parameter

  oCGI = new MailCGISession('c:\mymailfolder')

  // Send sender address

  oCGI.From := "webmaster@mycompany.com"

  // Send recipient information

  oCGI.To.add(cEmailAddress) // Add data to oCGI "to" array

  oCGI.Cc.add(cCCAddress1)

  oCGI.Cc.add(cCCAddress2)

  // Send subject

  oCGI.Subject := "Thank You!"  // Set Subject

  // The Body property contains the entire text

  // of the message, and must be pre-formatted

  // You'll need to control the line length and add

  // end-of-line markers as appropriate

  oCGI.Body = "Dear Mr. " + cLastName + CRLF + CRLF

  oCGI.Body += "Thank you very much for your comments." + CRLF

  oCGI.Body += "We will take the appropriate action." + CRLF + CRLF

  oCGI.Body += "Jane Doe" + CRLF

  oCGI.Body += "webmaster@mycompany.com"

  oCGI.PostForPickup( )  // Send mail message to text file

catch (exception e)

  oCGI.errorPage(e)

endtry

There are two drawbacks to this method of posting mail:

1.   You must be using Windows NT Server and running Microsoft Internet Information Server as your Web server.

2.   There is no feedback (except, of course for the NT logs) to confirm, or report, an error in the mail send. You don't know if the mail has or has not been sent until you check the logs.

Database Interface

The other alternative is the one used in the Message Server included in the Web Samples on the dBASE Plus CD. This is a full-time, 24/7 dBASE Plus application that runs on either your Web server, or preferably, on another dedicated computer. It runs just fine even as a background task on a Windows 98 computer as long as it has access to your tables over the network.

This is a polling application that continually re-queries your table to see if any new orders, attendees, or requests for information have been added. It then uses the information in the new row to compose and send an eMail wherever you want it to go. The Message Server shipped with dBASE Plus is set up to use the Attendees table used in the Signup Web sample. Each time a new attendee registers, the Message Server sends out an eMail confirming the registration.

This application uses the wonderful Mail library from MarshallSoft. This powerful DLL adds direct mail-server connection, control, download and mailbox management to your dBASE Plus applications.

This is a much more complex solution than Bowen's, but it generates its own HTML logs that can be accessed remotely, is almost infinitely scalable (high transaction volume? Just add one more computer on the network running the Message Server), and it updates your table to cofirm when eMail was sent. It doesn't even require Windows NT or IIS.

 

For more detail on how the Message Server works, see the Readme.txt in the Plus/Web/MessageServer folder. dBASE Plus ships only the demo version of the MarshallSoft library. It works, but pops up an "alert"  that requires a mouse click to clear each time it sends mail. Check the dBASE Online store for information on ordering a fully-licensed copy.