In this example, a COM object is created. A CFSET defines a value for each method or property in the COM object interface. The last CFSET creates a variable to store the return value from the COM object's "SendMail" method.
<CFOBJECT ACTION="Create"
NAME="Mailer"
CLASS="SMTPsvg.Mailer">
<CFSET MAILER.FromName=form.fromname>
<CFSET MAILER.RemoteHost=RemoteHost>
<CFSET MAILER.FromAddress=form.fromemail>
<CFSET MAILER.AddRecipient("form.fromname", "form.fromemail")>
<CFSET MAILER.Subject="Testing CFOBJECT">
<CFSET MAILER.BodyText="form.msgbody">
<CFSET Mailer.SMTPLog="logfile">
<CFSET success=MAILER.SendMail()>
<CFOUTPUT> #success# </CFOUTPUT>
|