home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 June
/
PCWorld_2002-06_cd.bin
/
Software
/
Komercni
/
xbase
/
express
/
exd17208.r04
/
exp17
/
Samples
/
Xoutlook.prg
< prev
next >
Wrap
Text File
|
2002-01-30
|
2KB
|
85 lines
//
// Copyright (c) 1997,1998 JAZZAge Software SARL
//
// OUTLOOK ActiveX Client
//
// NOTE: The classes defined below have cut and pasted form the OUTLOOK.prg file, generated by
// JA 'CE'.
//-----------------------------------------------------------------------------------------------
#define olByReference 4
#define olMailItem 0
#define _OutlookApplication_
#define _OutlookMailItem_
#include "common.ch"
#include "dcdialog.ch"
#include "JACE30XPP.ch"
#pragma Library("JACP30XPPCOFF.LIB")
PROCEDURE SendMailToOutlook( cSubject, cBody, acFile, acEmail )
LOCAL oOutlookApplication, oOutlookMailItem, oOutlookRecipients, ;
oOutlookAttachments, i, pUnk
IF Valtype(acFile) = 'C'
acFile := { acFile }
ENDIF
IF Valtype(acEmail) = 'C'
acEmail := { acEmail }
ENDIF
DEFAULT cSubject TO 'JazzAge Test', ;
cBody TO 'This is the Body of Text', ;
acFile TO {'\express\readme.txt'}, ;
acEmail TO {'support@donnay-software.com'}
BEGIN SEQUENCE
// Launching Outlook
oOutlookApplication:=OutlookApplication():new()
pUnk:=JAXPPGETACTIVEOBJECT('ProgID:Outlook.Application')
IF (pUnk==0)
pUnk:=JAXPPCREATEACTIVEXOBJECT('ProgID:Outlook.Application')
ENDIF
oOutlookApplication:Connect(pUnk)
// Creating a new MailItem
oOutlookMailItem:=OutlookMailItem():new()
oOutlookMailItem:Connect(<oOutlookApplication:CreateItem(olMailItem)>)
// Setting the new MailItem subject and body
<oOutlookMailItem:Subject := cSubject>
<oOutlookMailItem:Body := cBody>
// Setting the new MailItem recipients
FOR i := 1 TO Len(acEmail)
<oOutlookMailItem:Recipients:Add(acEmail[i])>
NEXT
// Adding the new MailItem a file attachment
FOR i := 1 TO Len(acFile)
<oOutlookMailItem:Attachments:Add(acFile[i])>
<oOutlookMailItem:Attachments[1]:DisplayName:="DisplayName">
NEXT
// Sending the new MailItem
oOutlookMailItem:Send()
oOutlookMailItem:Disconnect()
// Releasing Outlook
oOutlookApplication:Disconnect()
END SEQUENCE
return
#include 'outlook.prg'