Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
E-mail
Message
From
17/05/2004 14:20:00
 
 
To
17/05/2004 05:08:41
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: E-mail
Miscellaneous
Thread ID:
00904499
Message ID:
00904647
Views:
15
*- Parameters.:
*-
*- cRecipient : Receipient's E-mail
*- cCCList : Copy to
*- cSubject : E-mail Subject
*- cMessage : E-mail Message
*- cAttachment : E-mail Attachement
*-
*- Objects....:
*-
*------------------------------------------------------------------------------


PARAMETER cRecipient,cCCList,cSubject,cMessage,cAttachment

IF TYPE('oOutlook')=='O'
RELEASE oOutlook
ENDIF

LOCAL lcError, llOutlookError

lcError = ON("ERROR")

llOutlookError = .F.

ON ERROR llOutlookError = .T.

oOutlook=CREATEOBJECT("Outlook.application")
oSpace=oOutlook.Getnamespace("MAPI")
oMsg=oSpace.GetDefaultFolder(6)
oNew=oMsg.Items.ADD()

ON ERROR &lcError.

IF TYPE('oOutlook') <> "O" OR ;
TYPE('oMsg') <> "O" OR ;
TYPE('oNew') <> "O"
RETURN .F.
ENDIF

cString=cRecipient

lcstring=cString
DO WHILE .T.
token=''
N=AT(';',lcstring)
IF N=0
token=lcstring
EXIT
ELSE
token=SUBSTR(lcstring,1,N-1)
lcstring=SUBSTR(lcstring,N+1)
ENDIF
oNew.Recipients.ADD(token)
ENDDO
IF !EMPTY(ALLTRIM(token))
oNew.Recipients.ADD(token)
ENDIF

*----------------------------------
*- Send a copy to the author of the e-mail
IF NOT EMPTY(ALLTRIM(cCCList))
*- JCZA
*- 01/03/2003

cString=cCCList

lcstring=cString
DO WHILE .T.
token=''
N=AT(';',lcstring)
IF N=0
token=lcstring
EXIT
ELSE
token=SUBSTR(lcstring,1,N-1)
lcstring=SUBSTR(lcstring,N+1)
ENDIF
orecip=oNew.Recipients.ADD(token)
orecip.TYPE=2 && copy cc
ENDDO
IF !EMPTY(ALLTRIM(token))
orecip=oNew.Recipients.ADD(token)
orecip.TYPE=2 && copy cc
ENDIF
ENDIF
oNew.Subject=cSubject
oNew.Body=cMessage
IF !EMPTY(ALLTRIM(cAttachname))
oNew.Attachments.ADD(cAttachment,1,1,cAttachname)
ENDIF

RETURN oNew.SEND()
Previous
Reply
Map
View

Click here to load this message in the networking platform