Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Bloco de código
languagejava
themeEclipse
firstline1
titleProgress: sendWithAttachment
linenumberstrue
collapsetrue
{utp/ut-mail-api.i}

DEFINE VARIABLE h_mail AS HANDLE NO-UNDO.

IF NOT VALID-HANDLE(h_mail) THEN DO: 
	RUN utp/ut-mail-api.p PERSISTENT SET h_mail.
END.

DEFINE VARIABLE c_to                    AS CHARACTER NO-UNDO EXTENT.
DEFINE VARIABLE c_cc                    AS CHARACTER NO-UNDO EXTENT.
DEFINE VARIABLE c_bcc                   AS CHARACTER NO-UNDO EXTENT.
DEFINE VARIABLE c_subject               AS CHARACTER NO-UNDO INITIAL 'Teste API Progress - Datasul Mail Service':U.
DEFINE VARIABLE c_from                  AS CHARACTER NO-UNDO INITIAL '[email protected]':U.
DEFINE VARIABLE c_from_name             AS CHARACTER NO-UNDO INITIAL 'Datasul Mail Service':U.
DEFINE VARIABLE lc_content_mail         AS LONGCHAR  NO-UNDO.
DEFINE VARIABLE l_html                  AS LOGICAL   NO-UNDO INITIAL TRUE.
    
DEFINE VARIABLE c_read_notification     AS LOGICAL   NO-UNDO INITIAL TRUE.
DEFINE VARIABLE i_delivery_notification AS LOGICAL   NO-UNDO INITIAL TRUE.
DEFINE VARIABLE i_return_type           AS LOGICAL   NO-UNDO INITIAL TRUE.

ASSIGN lc_content_mail = 'Teste de envio de e-mail pelo PROGRESS :D':U.

EXTENT (c_to) = 1.                                       
ASSIGN c_to[1] = '[email protected]':U.

CREATE ttAttachment.
ASSIGN ttAttachment.fileName = '<NOME ANEXO 1>'.
    
COPY-LOB FROM FILE '<CAMINHO ANEXO 1>' 
	TO ttAttachment.fileContent NO-CONVERT NO-ERROR.

RUN sendWithAttachmentsendEmail IN h_mail(
    INPUT c_to,
    INPUT c_cc,
    INPUT c_bcc,
    INPUT c_subject,
    INPUT c_from,
    INPUT c_from_name,
    INPUT lc_content_mail,
    INPUT l_html,
	INPUT '[email protected]',
    INPUT 1,
	INPUT 1,
	INPUT TABLE ttAttachment,
	OUTPUT mptr_response,
    OUTPUT i_response_code,
	OUTPUT c_response_status
).

IF VALID-HANDLE(h_mail) THEN DO: 
	DELETE PROCEDURE h_mail.
END.

...