![]() ![]() ![]() |
In the following example, an SMTP mail handling component is created using CFOBJECT.
<CFOBJECT ACTION=CREATE NAME=MAILER CLASS=SMTP.Mailer>
The component needs to be created by ColdFusion before any methods in the component can be invoked or properties assigned in your application pages. This (hypothetical) SMTP component includes a large number of methods and properties you can use to perform a wide range of mail handling tasks. Methods perform actions and have return values you can use. Properties often return information or store information about a component. They do not execute and may not include any parameters. In the OLE/COM Viewer, methods and properties may be grouped together, making it a little confusing at first to determine one from the other.
Our hypothetical SMTP mail component includes properties such as:
You use these properties to define elements of the mail message you want to send. The SMTP Mailer component also includes a number of methods, such as:
There are essentially two ways to create objects using CFOBJECT: Using the Create method, which takes a COM object and instantiates it. The other connection type uses the Connect method, which links to an object that is already running on the server.
The CFOBJECT ACTION attribute accepts two arguments, CREATE and CONNECT. You use CREATE to instantiate the object (typically a DLL) prior to invoking methods or assigning properties.
You use CONNECT to connect to an object (typically an EXE) that is already running on the specified server.
The CFOBJECT CONTEXT attribute accepts three arguments:
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.