Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Clear Embedded Font
sets custom cursors
myDialog
CTRL+B, CTRL+I, CTRL+U
Datagrip Net
Find a drive with a specific name/Find CD Drives
Scale Vertexlist
Interactive Flash File Behavior
Play/ Pause/ Rewind/ StepForward/ StepBackward Video Sprite
A Star Lingo Pathfinding Algorithm
 

 

 

Behavior Sending a e-mail with attachment using CDO and VbScriptXtra

Added on 9/17/2002

 

Compatibilities:
behavior D7 D8 D8_5 PC

Required Xtras:
VbScript Xtra

This item has not yet been rated

Author: Eugene Shoustrov (website)

The behavior sends a e-mail message with attached file (if any). It uses Microsoft CDO for Windows 2000 Library. CDO (Collaboration Data Objects) are accessed using VbScriptXtra. To use this behavior replace SMTP server setting to a proper value.

-- 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
    exit
  end if
  conf.fields[conf.cdoSendUsingMethod] = conf.cdoSendUsingPort
  conf.fields[conf.cdoSMTPServer].Value = "smtpServerHere"
  conf.fields.Update()
  
  mes = xtra("VbScriptXtra").CreateObject("CDO.Message")
  mes.Configuration = conf
  mes.To = strTo
  mes.From = "someone@domain.com"
  mes.textBody = strText
  
  --Attaching a file to the message (if any)
  if stringP(strFileToAttach) then
    mes.AddAttachment(strFileToAttach)
  end if
  
  mes.Send()
  if mes.failed then alert mes.LastError
  
  -- Voiding out CDO objects to initiate actual message sending
  mes=void
  conf=void
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail