*Sample DDE Program with cc:Mail
*This program can be used to send error messages in programs
*or it can be used as an interface to cc:Mail
*note that no error handling is included, but could easily be incorporated
*by checking the status of lnResult after each call, or by using DO WHILE loops 

lnResult = DDESetOption("SAFETY",.F.)
lnResult = DDESetOption("TIMEOUT",60000)
iChannel = DDEInitiate("wmail","SendMail")

IF iChannel < 0
	RUN /N2 Y:\APPS\WINMAIL\WMAIL.EXE
	WAIT TIMEOUT 10
	iChannel = DDEInitiate("wmail","SendMail")
	
ENDIF


IF iChannel < 0
	RETURN
ENDIF

* -- This sends specific, hard coded text as the message
* -- Receipient is also hard coded
lnResult=DDEExecute(iChannel,"NewMessage")
lnResult=DDEExecute(iChannel,"To Robert F Hughes")
lnResult=DDEExecute(iChannel,"Subject Foxpro Mail Test")
lnResult=DDEExecute(iChannel,"Text This is a test using Foxpro")
inResult=DDEExecute(iChannel,"Address")
lnResult=DDEExecute(iChannel,"Send")

* -- This sends variable text, and prompts for receipient name
lcText = "Sample Message Number 2"

lnResult=DDEExecute(iChannel,"NewMessage")
lnResult=DDEExecute(iChannel,"Subject Foxpro Mail Test 2")
lnResult=DDEExecute(iChannel,"Text "+ lcText)
inResult=DDEExecute(iChannel,"Address")
lnResult=DDEExecute(iChannel,"Send")

lnResult=DDETerminate(iChannel)
