A list of products available on this site
Documentation for XtraMania's xtras
Prices and links to the online store
Xtras, PDFs, samples
Have a question? Ask us!
Logo. www.xtramaina.com  
Home Search E-mail
VbScriptXtra Samples/Sending e-mail

ActiveCompanionSet xtras for Macromedia Director

Sending e-mail using CDO (Collaboration Data Objects)

The sample below sends a e-mail message with attached file (if any). It uses Microsoft CDO for Windows 2000 Library. The sample was not tested on other Windows versions.

-- Handler uses CDO.Configuration and CDO.Message objects
-- to send e-mail
on SendMail strTo, strText, strFileToAttach
  conf = xtra("VbScriptXtra").CreateObject("CDO.Configuration")
  if stringP(conf) then
    alert conf
  end if
  conf.fields[#cdoSendUsingMethod].Value = #cdoSendUsingPort
  conf.fields[#cdoSMTPServer].Value = "smtpServerHere"
  mes = xtra("VbScriptXtra").CreateObject("CDO.Message")
  mes.Configuration = conf
  mes.To = strTo
  mes.From = ""
  mes.textBody = strText
  --Attaching a file to the message (if any)
  if stringP(strFileToAttach) then
  end if
  if mes.failed then alert mes.LastError
  -- Voiding out CDO objects to initiate actual message sending

Where to find more info about CDO library?

CDO is fully documented at msdn.microsoft.com.

VbScriptXtra provides autodocumentation feature allowing you to see what you can do with particular object instance. Just create a recordset object and type in Messages window:
put interface(conf)
put interface(conf.fields)
put interface(mes)

ObjectBrowser xtra - autodocumentation companion for VbScriptXtra - will show all available CDO interfaces, methods, properties and enumerations.

ObjectBrowser xtra is a part of ActiveCompanionSet. It is available to Download.

Site homeSearchContact author © Eugene Shoustrov. www.xtramania.com