JavaScript Editor js editor     Web development 

Main Page

File: ...\Samples\Solution\OLE\Sendmail.scx

This sample illustrates using the mailbtn class in ...\Samples\Classes\Buttons.vcx to create a simple messaging form that can send Visual FoxPro data to an e-mail address.

Mailbtn is a container class that contains a command button and two ActiveX controls: MAPI Session and MAPI Messages, both of which are defined in Msmapi32.ocx. The MAPI Session control establishes a MAPI session, and the MAPI Messages control makes it possible for the user to perform a variety of messaging system functions.

The mailbtn class starts a new Mail session, collects data from the current record, and brings up the Send Mail dialog with the data inserted as the message text.

This class includes two custom methods AddTabs and StripPath for formatting the information gathered from the table and inserted in the mail message.

This class also takes advantage of another custom method called Signon as well as a custom property called logsession, which is set to .F. initially.

When the user clicks the cmdMail button, the following code in the Click event calls the signon method, setting logsession to true (.T.).:

В Copy Code
this.logsession = .T.

If there is a failure on signon, the Error event of the class is called and logsession is set to .F.

The MAPI controls are invisible at run time. In addition, there are no events for the controls. To use them, you must specify the appropriate methods. For these controls to work, MAPI services must be present. MAPI services are provided in Microsoft Outlook and Exchange electronic mail systems for Microsoft Windows 95 or later.

See Also

JavaScript Editor js editor     Web development