Example of using 16-bit ccMail. I am not sure how well this works with 32-bit ccMail systems.
Kevin
****************************
*PROCEDURE ccMail_s.prg && send ccMail via DDE
*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
PARAMETERS jcSubject, jaSendTo, jcMessage, JaAttach, jaCcTo
* jcSubject: Subject header text (Required)
* jcSendto: person people to send to (Required)
* jcMessage: Body of text in mail (Required)
* jcAttach: attachment (Optional)
* jcCcTo: cc example(Optional)
** Note Actually it looks like I am copying the message to the clipboard
** and then pasting the message in (instead of using jcMessage)-- oh well I
** haven't really look at this code in a while.
*************************************
lnResult = DDESetOption("SAFETY",.F.)
lnResult = DDESetOption("TIMEOUT",60000)
iChannel = DDEINITIATE("wmail","SendMail")
** This example assumes that ccMail is already open, if you need to run ccMail
** 1st I have some other code to look at.
** I also cut out a bunch of code that convert arrays that were passed as parameters (like jaSendto vs. jcSendto that I show below). I thought it would make your 1st example easier.
lnResult=DDEEXECUTE(iChannel,"NewMessage")
lnResult=DDEEXECUTE(iChannel,"Subject "+ jcSubject)
*The message was already in the clipboard
inResult=DDEEXECUTE(iChannel,"Paste")
lnResult=DDEEXECUTE(iChannel,"To " + jcSendto)
IF type('jcccto')<>'L' and not empty(jcCCto)
lnResult=DDEEXECUTE(iChannel,"CC " + jCCTo)
ENDIF
IF type('jcAttach')<>'L' and not empty(jcAttach)
lnResult=DDEEXECUTE(iChannel,"attachfile " + lcAttach1)
ENDIF
*4. Launch ccMail & send default message w/ default from/to
inResult=DDEEXECUTE(iChannel,"Address")
lnResult=DDEEXECUTE(iChannel,"Send")
lnResult=DDETERMINATE(iChannel)
WAIT clear
RETURN