Consultor Eletrônico



Kbase P68323: How to send Mail from Lotus Notes using Progress 4GL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   13/10/2006
Status: Verified

GOAL:

How to send Mail from Lotus Notes using Progress 4GL?

GOAL:

Sending Mail from 4GL to Lotus Notes

FIX:

/* PARAMETERS */
DEFINE INPUT PARAMETER cuerpo AS CHAR. /* Body */
DEFINE INPUT PARAMETER titulo AS CHAR. /* Title*/
DEFINE INPUT PARAMETER direcciones AS CHAR. /* Addresses */
DEFINE INPUT PARAMETER adjunto AS CHAR. /* Attachment */

/*VARIABLES FOR THE MAIL*/
DEFINE VARIABLE LNS AS COM-HANDLE.
DEFINE VARIABLE Db AS COM-HANDLE.
DEFINE VARIABLE Doc AS COM-HANDLE.
DEFINE VARIABLE Texto AS COM-HANDLE.
DEFINE VARIABLE Dbloc AS CHARACTER.


CREATE "Notes.NotesSession":U LNS NO-ERROR.
/*Create a session with Lotus Notes*/

Dbloc = LNS:GETENVIRONMENTSTRING("MailFile",true).
/*Take the name of the user DB*/

db = LNS:GETDATABASE("CACLTMX03",dbloc).
/* Opens the DB in the Server CACLTMX03*/

doc = db:CREATEDOCUMENT.
/*Create a Document in the DB*/

doc:FORM = "memo".
/* Gives format to the newly created Document*/

texto = doc:CREATERICHTEXTITEM("BODY").
/*Create a body for the text*/

texto:APPENDTEXT(cuerpo).
/*The Message is Written*/

IF (adjunto <> "") THEN
/*Add the Attachment, The Parameter 1454 and "", should be respected */

texto:EMBEDOBJECT(1454, "", adjunto).
/* adjunto is the route of the file attached */

doc:SUBJECT = titulo.
/*Title of the Message*/

doc:SEND(FALSE,direcciones).
/*addresses are added separated by commas "," */