From: richard.townsendrose on
Hi all,

below is the code for using outlook to send email, based on what Marti
published in 2001. it has worked well for us since then...

now a client wants to add some cc's to it ...

i see from other posts, particularly a response from geoff at
http://groups.google.com/group/comp.lang.clipper.visual-objects/browse_thread/thread/c00df8f55886d10a/bd0d4f7f1067304b?lnk=gst&q=outlook+cc+email#bd0d4f7f1067304b

that there is a recipient type to set ...

so where in the code below do i need to set it and how ?

regards

richard

METHOD SendMailOutLook() CLASS EmailSend
LOCAL lOk:=TRUE AS LOGIC
LOCAL cbCurrErrorBlock AS CODEBLOCK
LOCAL oOutlook AS USUAL
LOCAL oMail AS USUAL
LOCAL oAttachment AS USUAL
LOCAL n AS DWORD

// Init outlook object
oOutlook:=OleAutoObject{"Outlook.Application"}

// Save old Error handler
cbCurrErrorBlock:=ErrorBlock()
BEGIN SEQUENCE
// Create new handler
ErrorBlock({|oErr| OutlookErrorFunction(oErr)}) // error
function issues a "break"
// Create new mailitem
SELF:cErrorMsg:='Error creating link to Outlook'
oMail:=oOutlook:CreateItem(0)

IF ALen(SELF:aRecipients) > 0 // rgtr 260608
SELF:cErrorMsg:='Error adding recipients to Outlook'
// Add recipients
FOR n:=1 UPTO ALen(SELF:aRecipients)
oMail:Recipients:Add(SELF:aRecipients[n])
NEXT

IF ALen(SELF:aCCs) > 0 // rgtr 270510
FOR n:=1 UPTO ALen(SELF:aCCs)
oMail:Recipients:Add(SELF:aCCs[n])
// ******** oMail:Recipients:Type := 2 // HELP HELP HELP
NEXT
ENDIF
From: richard.townsendrose on
Hi all,

> i see from other posts, particularly a response from geoff at
http://groups.google.com/group/comp.lang.clipper.visual-objects/browse_thread/thread/c00df8f55886d10a/bd0d4f7f1067304b?lnk=gst&q=outlook+cc+email#bd0d4f7f1067304b

seems like this requires an addon to outlook called Redemption ..

http://www.dimastr.com/redemption/download.htm

regards

richard
From: richard.townsendrose on
Hi all,

fix is easy ...

need a local oRecip as object

then

>                 IF ALen(SELF:aCCs) > 0      // rgtr 270510
>                         FOR n:=1 UPTO ALen(SELF:aCCs)
FIX HERE >>               oRecip:=oMail:Recipients:Add(SELF:aCCs[n])
FIX HERE >>          oRecip:Type := 2   // default is 1
>                         NEXT
>                 ENDIF

and for Mapi

FOR n := 1 UPTO ALen(SELF:aCCs) // rgtr 270510
aRecip[n].ulReserved := 0
aRecip[n].ulRecipClass := MAPI_CC
aRecip[n].lpszName := PSZ(_CAST,
StringAlloc( SELF:aCCs[n] ) )
aRecip[n].lpszAddress := PSZ(_CAST,
StringAlloc( SELF:aCCs[n] ) )
aRecip[n].ulEIDSize := 0
aRecip[n].lpEntryID := NULL_PTR
NEXT

richard