How do I send email from ATEasy?

Knowledge Base Article # Q200071

Read Prior Article Read Next Article
Summary Sending an email using Microsoft CDO ActiveX/COM library
  
Login to rate article
Solution:

You can do it by using the Microsoft CDO ActiveX/COM library :

1. Insert the CDO library to your module

2. Define the following variables:

cdocfg: CDO.Configuration
msg: CDO.Message
sMyHTMLMessage: String  ! HTML message

3. The following code is an example of how to use the CDO library to send email (may require some changes for error handling message text):

! create configuration
cdocfg=CreateObject("CDO.Configuration")
cdocfg.Fields.Item(cdoSMTPConnectionTimeout).Value=400
cdocfg.Fields.Item(cdoSMTPServer).Value="10.10.1.1" ! server address could be also something like "smtp.primenet.com"
cdocfg.Fields.Item(cdoSendUsingMethod).Value=cdoSendUsingPort
cdocfg.Fields.Update()

! create a message
msg=CreateObject("CDO.Message")
msg.Configuration=cdocfg
msg.From="rony@geotestinc.com"
msg.Subject="Hello world!"
msg.HTMLBody=sMyHTMLMessage
msg.To="\"Ron Y\""

! send the message
Try
   msg.Send()
Catch Else
   ! error message
EndTry

!clean up
mgs=Nothing
cdocfg=Nothing


Article Date 4/18/2006
Keywords ATEasy, email, CDO, CreateObject


Login to rate article

Read Prior Article Read Next Article