-
3
- #1
If you need to create a new e-mail message with attachment file using outlook and PowerCOBOL V.6.1:
*******
REPOSITORY
CLASS COM AS "*COM".
*******
powercobol v.6.1 button click
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CONTROLLI.
03 SUB-1 PIC S9(9) COMP-5.
03 OUT_CONTR.
05 OUT_APP PIC X(28) VALUE "Outlook.APPLICATION".
05 OUT_OL OBJECT REFERENCE COM.
05 B-STRING PIC X(1024).
05 OUT-CONT OBJECT REFERENCE COM.
05 OUT-DEF OBJECT REFERENCE COM.
05 OUT_DEST OBJECT REFERENCE COM.
05 OUT_SOGG OBJECT REFERENCE COM.
05 OUT_FILE OBJECT REFERENCE COM.
05 B-FLAG PIC S9(9) COMP-5.
PROCEDURE DIVISION.
******************** nuovo messaggio 0
A.
SET OUT-CONT TO NULL
SET OUT-DEF TO NULL
SET OUT_DEST TO NULL
SET OUT_SOGG TO NULL
SET OUT_FILE TO NULL
MOVE 0 TO B-FLAG
INVOKE COM "CREATE-OBJECT" USING OUT_APP
RETURNING OUT_OL
************************* 0=MESSAGGIO POSTA ELETTRONICA
MOVE 0 TO B-FLAG
INVOKE OUT_OL "CREATEITEM" USING B-FLAG
RETURNING OUT-CONT
MOVE "xxxx@ssss.it" OF TB-SITE TO B-STRING
INVOKE OUT-CONT "Recipients" RETURNING OUT_SOGG
INVOKE OUT_SOGG "Add" USING B-STRING
MOVE "xxxx@xxxxt.it" TO B-STRING
INVOKE OUT-CONT "SET-Cc" USING B-STRING
MOVE "xxxxx@xxxxxo.it" TO B-STRING
INVOKE OUT-CONT "SET-Bcc" USING B-STRING
MOVE "trasmissione file automatica" TO B-STRING
INVOKE OUT-CONT "SET-Subject" USING B-STRING
MOVE "Testo del messaggio" TO B-STRING
INVOKE OUT-CONT "SET-Body" USING B-STRING
* 0 LOW 2 HIGH
MOVE 2 TO B-FLAG
INVOKE OUT-CONT "SET-Importance" USING B-FLAG
* 1 NORMALE 2 HTLM 3 RTF
MOVE 1 TO B-FLAG
INVOKE OUT-CONT "Set-BodyFormat" USING B-FLAG
INVOKE OUT-CONT "Attachments" RETURNING OUT_FILE
MOVE "C:\AAA.TXT" TO B-STRING
INVOKE OUT_FILE "Add" USING B-STRING
**********************
if you want see the new message
INVOKE OUT-CONT "Display"
if you want send
INVOKE OUT-CONT "Send"
EXIT PROGRAM.
fsccdm
*******
REPOSITORY
CLASS COM AS "*COM".
*******
powercobol v.6.1 button click
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CONTROLLI.
03 SUB-1 PIC S9(9) COMP-5.
03 OUT_CONTR.
05 OUT_APP PIC X(28) VALUE "Outlook.APPLICATION".
05 OUT_OL OBJECT REFERENCE COM.
05 B-STRING PIC X(1024).
05 OUT-CONT OBJECT REFERENCE COM.
05 OUT-DEF OBJECT REFERENCE COM.
05 OUT_DEST OBJECT REFERENCE COM.
05 OUT_SOGG OBJECT REFERENCE COM.
05 OUT_FILE OBJECT REFERENCE COM.
05 B-FLAG PIC S9(9) COMP-5.
PROCEDURE DIVISION.
******************** nuovo messaggio 0
A.
SET OUT-CONT TO NULL
SET OUT-DEF TO NULL
SET OUT_DEST TO NULL
SET OUT_SOGG TO NULL
SET OUT_FILE TO NULL
MOVE 0 TO B-FLAG
INVOKE COM "CREATE-OBJECT" USING OUT_APP
RETURNING OUT_OL
************************* 0=MESSAGGIO POSTA ELETTRONICA
MOVE 0 TO B-FLAG
INVOKE OUT_OL "CREATEITEM" USING B-FLAG
RETURNING OUT-CONT
MOVE "xxxx@ssss.it" OF TB-SITE TO B-STRING
INVOKE OUT-CONT "Recipients" RETURNING OUT_SOGG
INVOKE OUT_SOGG "Add" USING B-STRING
MOVE "xxxx@xxxxt.it" TO B-STRING
INVOKE OUT-CONT "SET-Cc" USING B-STRING
MOVE "xxxxx@xxxxxo.it" TO B-STRING
INVOKE OUT-CONT "SET-Bcc" USING B-STRING
MOVE "trasmissione file automatica" TO B-STRING
INVOKE OUT-CONT "SET-Subject" USING B-STRING
MOVE "Testo del messaggio" TO B-STRING
INVOKE OUT-CONT "SET-Body" USING B-STRING
* 0 LOW 2 HIGH
MOVE 2 TO B-FLAG
INVOKE OUT-CONT "SET-Importance" USING B-FLAG
* 1 NORMALE 2 HTLM 3 RTF
MOVE 1 TO B-FLAG
INVOKE OUT-CONT "Set-BodyFormat" USING B-FLAG
INVOKE OUT-CONT "Attachments" RETURNING OUT_FILE
MOVE "C:\AAA.TXT" TO B-STRING
INVOKE OUT_FILE "Add" USING B-STRING
**********************
if you want see the new message
INVOKE OUT-CONT "Display"
if you want send
INVOKE OUT-CONT "Send"
EXIT PROGRAM.
fsccdm