Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Pedro-Botelho-Cruz-J Absent Member.
Absent Member.
1477 views

Email pelo Cobol (AcuCobol)

Boa tarde.

O programa abaixo envia email pelo Cobol (AcuCobol) mas não tenho a biblioteca em destaque.

Alguém teria a biblioteca:  MSMAPI32.DEF para me fornecer. Pode ser em pvt: pjrsil@uol.com.br

Agradeço retorno.

Pedro Junior

 

 

IDENTIFICATION DIVISION.

PROGRAM-ID. OLEMAPI.
ENVIRONMENT DIVISION.
*====================
*
* Copyright (c) 1996-2001 by Acucorp, Inc. Users of ACUCOBOL
* may freely modify and redistribute this program.
*
* This sample demonstrates how to use the Microsoft MAPI OLE Library
* from ACUCOBOL-GT to send emails.
* Note that this example application requires the use of the attached
* definition file, using another definition file for the MAPI object
* may cause the application to fail.
*
* This technique should work with both OutLook and OutLook Express,
* however, there are some requirements. Take a look at these URLs
* if you experience any problems (urls valid as of 14 November 2001)
http://support.microsoft.com/support/kb/articles/q180/5/05.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi98/html/vbobjmapis.asp
*
* For an overview of the OLE MAPI object:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi98/dt_vbobjMAPIS_C.asp
*
* This sample is provided by Acucorp, Inc. 'as is',
*
*
*====================
SPECIAL-NAMES.
COPY "MSMAPI32.DEF".
.
WORKING-STORAGE SECTION.

77 MYSESSION HANDLE OF MAPISESSION OF MSMAPI.
77 MYMESSAGE HANDLE OF MAPIMESSAGES OF MSMAPI.
77 MYSESSID PIC S9(9) COMP-5.
77 CNTL-FONT USAGE HANDLE OF FONT SMALL-FONT.
77 MY-RECIP-NAME PIC X(255) VALUE SPACE.
77 MY-RECIP-ADDR PIC X(255) VALUE SPACE.

PROCEDURE DIVISION.

MAIN-LOGIC.

DISPLAY STANDARD GRAPHICAL WINDOW
LINES 16
SIZE 30
BACKGROUND-LOW
CONTROL FONT IS CNTL-FONT
CELL HEIGHT 12
CELL WIDTH 12
TITLE
"Microsoft OLE MAPI demonstration".

MOVE "John Doe" TO MY-RECIP-NAME.
MOVE "jdoe@doe.com" TO MY-RECIP-ADDR.

IF MY-RECIP-NAME = SPACE
OR MY-RECIP-ADDR = SPACE
INSPECT MY-RECIP-NAME REPLACING TRAILING
SPACES BY LOW-VALUES
INSPECT MY-RECIP-ADDR REPLACING TRAILING
SPACES BY LOW-VALUES
DISPLAY MESSAGE BOX
"Recipient name and/or address must be set "
X"0A"
"Prior to using this software."
X"0A"
"Please adjust your code and recompile."
X"0A"
X"0A"
"Current name: "
MY-RECIP-NAME
X"0A"
"Current address: "
MY-RECIP-ADDR
TITLE "Incomplete address"
GO TO MAIN-LOGIC-END.


DISPLAY LABEL "Creating the session control..." AT 0101.
CREATE MAPISESSION OF MSMAPI
LICENSE-KEY "mgkgtgnnmnmninigthkgogggvmkhinjggnvm"
HANDLE IN MYSESSION.

DISPLAY LABEL "Creating the message control..." AT 0201.
CREATE MAPIMESSAGES OF MSMAPI
LICENSE-KEY "mgkgtgnnmnmninigthkgogggvmkhinjggnvm"
HANDLE IN MYMESSAGE.

DISPLAY LABEL "Disabling mail download..." AT 0301.
MODIFY MYSESSION DOWNLOADMAIL 0.

DISPLAY LABEL
"Logon the mail engine, using default profile..."
AT 0401.
MODIFY MYSESSION SIGNON().

DISPLAY LABEL "Obtain the session id..." AT 0501.
INQUIRE MYSESSION SESSIONID MYSESSID.

DISPLAY LABEL
"Associate the message with the current session..."
AT 0601.
MODIFY MYMESSAGE SESSIONID = MYSESSID.

DISPLAY LABEL "Prepare a new message..." AT 0701.
MODIFY MYMESSAGE COMPOSE().

DISPLAY LABEL "Set the message subject..." AT 0801.
MODIFY MYMESSAGE MSGSUBJECT =
"This is the subject".

DISPLAY LABEL "Set the message body text..." AT 0901.
MODIFY MYMESSAGE MSGNOTETEXT =
"Hello world from ACUCOBOL-GT using OLE MAPI".

* If you have multiple files, duplicate the MODIFY statement,
* but increment by one for each additional file, like:
* File 1: ATTACHMENTINDEX = 0 ATTACHMENTPOSITION 0
* File 2: ATTACHMENTINDEX = 1 ATTACHMENTPOSITION 1
* and so on

DISPLAY LABEL "Sending an attachment..." AT 1001.
MODIFY MYMESSAGE ATTACHMENTINDEX = 0
ATTACHMENTPOSITION = 0
ATTACHMENTPATHNAME =
"olemapi.cbl".

DISPLAY LABEL "Set recipient 'real' name..." AT 1101.
MODIFY MYMESSAGE RECIPDISPLAYNAME =
MY-RECIP-NAME.

DISPLAY LABEL "Set recipient email address..." AT 1201.
MODIFY MYMESSAGE RECIPADDRESS =
MY-RECIP-ADDR.

DISPLAY LABEL "Send message, no verification dialog..."
AT 1301.
MODIFY MYMESSAGE SEND(0).

DISPLAY LABEL "Log off session..." AT 1401.
MODIFY MYSESSION SIGNOFF().

DISPLAY LABEL "Email transmit done..." AT 1501.
ACCEPT OMITTED AT 1523.

* Clean up
DESTROY MYMESSAGE.
DESTROY MYSESSION.


MAIN-LOGIC-END.

STOP RUN.

 

 

 

 

0 Likes
7 Replies
Micro Focus Expert
Micro Focus Expert

RE: Email pelo Cobol (AcuCobol)

MSMAPI32.DEF no es una biblioteca. ACUCOBOL-GT proporciona una utilidad llamada axdefgen (o netdefgen para ensamblados .Net), que hace que los archivos COBOL como MSMAPI32.def. El archivo describe todas las funciones contenidas en un ActiveX o dll. Como se ve en el programa de ejemplo, el msmapi32 es un ocx (ActiveX) o dll estándar de Windows.
Aquí un cupé de sitios que proporcionan MSMAPI32 (ocx o dll):
MSMAPI32.OCX descarga - archivos ocx gratis - OcxDump
Www.ocxdump.com/download-ocx ... / ocxfiles / M / MSMAPI32.OCX / 6 ... / download.htm ...
MSMAPI32.OCX descarga, aquí puede descargar el archivo ocx MSMAPI32.OCX de forma gratuita.
MSMAPI32.OCX: Descarga gratuita de .OCX. - OCXme.com
www.ocxme.com/.../msmapi32_ocx
Descargue MSMAPI32.OCX de forma gratuita y corrija cualquier error OCX que falte. Libre, seguro y seguro.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Email pelo Cobol (AcuCobol)

Como este ejemplo tiene 16 años, es poco probable que funcione con cualquier versión moderna de Outlook. Si busca en el foro community.microfocus.com para COBOL y correo electrónico, los desarrolladores de manu están dirigiendo sus intercambios de correo electrónico a través de gmail ...

https: //community.microfocus.com/microfocus/cobol/extend_and_acucobol/f/forum/10743/sending -email-using-gmail-and-other-newer-protocols

 

 

 

0 Likes
Pedro-Botelho-Cruz-J Absent Member.
Absent Member.

RE: Email pelo Cobol (AcuCobol)

Colega, preciso criar uma rotina no Cobol(AcuCobol) para enviar email. Atualmente estamos usando o Office365(MicroSoft) como base de emails e requer autenticação. Anteriormente utilizávamos o POSTIE: o Cobol chamava o postie passando alguns parâmetros, mas o postie não autentica no Office365. mas se conseguir alguma ferramenta que possa autenticar no office365 sendo chamado pelo Cobol e passando alguns parâmetros, ficaria muito agradecido.
0 Likes
Pedro-Botelho-Cruz-J Absent Member.
Absent Member.

RE: Email pelo Cobol (AcuCobol)

Colega,o arquivo de definições que tenho é o seguinte abaixo: que é diferente do MSMAPI32.DEF

*MSMAPI.DEF
*This definition file contains the variable declarations to operate
*with Microsoft Simple mail api

*NOTE: This definition file does not show the complete MS MAPI
* interface definition, nor is it provided in any other sense
* than "as is". Users are using this on their own discretion.
* Acucorp provide no liability for any unexpected behavior
* caused by the use of this code.

* Cobol space holders for POINTERs
01 MAPI-SUBJECT PIC X(512). | char[512];
01 MAPI-NOTETEXT PIC X(512). | char[4096];
01 ORG-NAME PIC X(512). | char[512];
01 ORG-ADDRESS PIC X(512). | char[512];
01 REC-NAME PIC X(512). | char[512];
01 REC-ADDRESS PIC X(512). | char[512];
01 MAPI-DATE-SENT PIC X(20). | char[20];
*end Cobol space holders for POINTERs

* Cobol variables accessed directly
01 H-ACU-WND SIGNED-INT IS EXTERNAL.
01 PREFERRED-PROFILE PIC X(65).
01 PREFERRED-PASSWORD PIC X(65).
01 PREFERRED-LOGON USAGE UNSIGNED-INT.
01 PREFERRED-SEND USAGE UNSIGNED-INT.
01 PREFERRED-RESOLVE USAGE UNSIGNED-INT.
01 DOC-DELIMITER PIC X(02).
01 DOC-FILEPATHS PIC X(4096).
01 DOC-FILENAMES PIC X(4096).
*end Cobol variables accessed directly

* Cobol household variables
01 CURRENT-DATE.
03 CURRENT-YEAR PIC 9(04).
03 CURRENT-MONTH PIC 9(02).
03 CURRENT-DAY PIC 9(02).

01 CURRENT-TIME.
03 CURRENT-HOUR PIC 9(02).
03 CURRENT-MIN PIC 9(02).
03 CURRENT-SEC PIC 9(02).
03 CURRENT-HUN PIC 9(02).

01 MAPI-RESULT USAGE SIGNED-INT.
01 MAPI-DISP-RESULT PIC Z(08)9.
01 MAPI-STATUS PIC 9(01).
88 MAPI-IS-LOGGED-IN VALUE 1.
88 MAPI-IS-LOGGED-OFF VALUE 0.

01 MAPI-ERR-STRING PIC X(40).

01 COPY-SIZE USAGE UNSIGNED-INT.

*end Cobol household variables

*The MAPI interface data definitions
01 MAPI-MESSAGE-PTR USAGE POINTER.

*MAPI C original struct
*typedef struct {
* ULONG ulReserved
* ULONG ulRecipClass;
* LPTSTR lpszName;
* LPTSTR lpszAddress;
* ULONG ulEIDSize;
* LPVOID lpEntryID;
*} MapiRecipDesc, FAR *lpMapiRecipDesc;
01 MSG-MAPI-ORG-DESCRIPTION.
03 MSG-ORG-RESERVED USAGE UNSIGNED-INT. | ULONG
03 MSG-ORG-CLASS USAGE UNSIGNED-INT. | ULONG
03 MSG-ORG-NAME USAGE POINTER. | LPTSTR
03 MSG-ORG-ADDR USAGE POINTER. | LPTSTR
03 MSG-ORG-EIDSIZE USAGE UNSIGNED-INT. | ULONG
03 MSG-ORG-ENTRYID USAGE POINTER. | LPVOID

*MAPI C original struct
*typedef struct {
* ULONG ulReserved
* ULONG ulRecipClass;
* LPTSTR lpszName;
* LPTSTR lpszAddress;
* ULONG ulEIDSize;
* LPVOID lpEntryID;
*} MapiRecipDesc, FAR *lpMapiRecipDesc;
01 MSG-MAPI-REC-DESCRIPTION.
03 MSG-REC-RESERVED USAGE UNSIGNED-INT. | ULONG
03 MSG-REC-CLASS USAGE UNSIGNED-INT. | ULONG
03 MSG-REC-NAME USAGE POINTER. | LPTSTR
03 MSG-REC-ADDR USAGE POINTER. | LPTSTR
03 MSG-REC-EIDSIZE USAGE UNSIGNED-INT. | ULONG
03 MSG-REC-ENTRYID USAGE POINTER. | LPVOID

*MAPI C original struct
*typedef struct {
* ULONG ulReserved;
* ULONG flFlags;
* ULONG nPosition;
* LPTSTR lpszPathName;
* LPTSTR lpszFileName;
* LPVOID lpFileType;
*} MapiFileDesc, FAR *lpMapiFileDesc;
01 MSG-MAPI-FILE-DESCRIPTION.
03 MSG-FILE-RESERVED USAGE UNSIGNED-INT. | ULONG
03 MSG-FILE-FLAGS USAGE UNSIGNED-INT. | ULONG
03 MSG-FILE-POS USAGE UNSIGNED-INT. | ULONG
03 MSG-FILE-PATH USAGE POINTER. | LPTSTR
03 MSG-FILE-NAME USAGE POINTER. | LPTSTR
03 MSG-FILE-TYPE USAGE POINTER. | LPVOID

*MAPI C original struct
*typedef struct {
* ULONG ulReserved;
* LPTSTR lpszSubject;
* LPTSTR lpszNoteText;
* LPTSTR lpszMessageType;
* LPTSTR lpszDateReceived;
* LPTSTR lpszConversationID;
* FLAGS flFlags;
* lpMapiRecipDesc lpOriginator;
* ULONG nRecipCount;
* lpMapiRecipDesc lpRecips;
* ULONG nFileCount;
* lpMapiFileDesc lpFiles;
*} MapiMessage, FAR *lpMapiMessage;
01 MAPI-MESSAGE.
03 MSG-RESERVED USAGE UNSIGNED-INT. | ULONG
03 MSG-SUBJECT USAGE POINTER. | LPTSTR
03 MSG-NOTETEXT USAGE POINTER. | LPTSTR
03 MSG-MSGTYPE USAGE POINTER. | LPTSTR
03 MSG-RECDATE USAGE POINTER. | LPTSTR
03 MSG-CONID USAGE POINTER. | LPTSTR
03 MSG-FLAGS USAGE UNSIGNED-INT. | FLAGS
03 MSG-MAPI-ORG-DESC-PTR USAGE POINTER. | lpMapiRecipDesc
03 MSG-REC-COUNT USAGE UNSIGNED-INT. | ULONG
03 MSG-MAPI-REC-DESC-PTR USAGE POINTER. | lpMapiRecipDesc
03 MSG-FILE-COUNT USAGE UNSIGNED-INT. | ULONG
03 MSG-MAPI-FIL-DESC-PTR USAGE POINTER. | lpMapiFileDesc

*MAPI C original definition
*LHANDLE lhsession
01 MAPI-SESSION-HANDLE USAGE HANDLE. | LPLPOINTER.
*end The MAPI interface data definitions

* MAPI constants
78 MAPI-RESERVED-NULL VALUE 0.
78 MAPI-UNREAD VALUE 1.
78 MAPI-RECEIPT-REQUESTED VALUE 2.
78 MAPI-SENT VALUE 4.

*MAPI SEND flags
78 MAPI-AUTOLOGON VALUE 0.
78 MAPI-LOGON-UI VALUE 1.
78 MAPI-DIALOG VALUE 8.

78 MAPI-PASSWORD-UI VALUE 131072.

78 MAPI-ERR-USER-ABORT VALUE 1.
78 MAPI-ERR-FAILURE VALUE 2.
78 MAPI-ERR-LOGON-FAILURE VALUE 3.
78 MAPI-ERR-DISK-FULL VALUE 4.
78 MAPI-ERR-MEMORY VALUE 5.
78 MAPI-ERR-ACCESS-DENIED VALUE 6.
78 MAPI-ERR-TOO-MANY-SESS VALUE 8.
78 MAPI-ERR-TOO-MANY-FILES VALUE 9.
78 MAPI-ERR-TOO-MANY-REC VALUE 10.
78 MAPI-ERR-FILE-NOT-FOUND VALUE 11.
78 MAPI-ERR-FILE-OPEN-FAIL VALUE 12.
78 MAPI-ERR-FILE-WRITE-FAIL VALUE 13.
78 MAPI-ERR-UNKNOWN-REC VALUE 14.
78 MAPI-ERR-BAD-RECIPTYPE VALUE 15.
78 MAPI-ERR-NO-MESSAGES VALUE 16.
78 MAPI-ERR-INVALID-MESSAGE VALUE 17.
78 MAPI-ERR-TEXT-TOO-LARGE VALUE 18.
78 MAPI-ERR-INVALID-SESSION VALUE 19.
78 MAPI-ERR-TYPE-UNSUPPORTED VALUE 20.
78 MAPI-ERR-AMBIGUOUS-REC VALUE 21.
78 MAPI-ERR-MESSAGE-IN-USE VALUE 22.
78 MAPI-ERR-NETWORK-FAILURE VALUE 23.
78 MAPI-ERR-INVALID-EDIT VALUE 24.
78 MAPI-ERR-INVALID-REC VALUE 25.
78 MAPI-ERR-NOT-SUPPORTED VALUE 26.
*end MAPI constants
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Email pelo Cobol (AcuCobol)

Sí, estoy seguro de que el msapi ha cambiado significativamente en los últimos 15 años. Es probable que Office365 se utilice como un servicio Web en lugar de un control ActiveX o .Net
Si busca en el foro community.microfocus.com para COBOL y correo electrónico, muchos desarrolladores están dirigiendo sus intercambios de correo electrónico a través de gmail ... https: //community.microfocus.com/microfocus/cobol/extend_and_acucobol/ F / forum / 10743 / sending -email-using-gmail-and-other-newer-protocols
No tengo ejemplos con Office365
0 Likes
Not applicable

RE: Email pelo Cobol (AcuCobol)

Se você tentar instalar os arquivos unfitpc.com/msmapi32-ocx ausentes mais eficazes no computador, mas não se preocupe com isso, isso lhe dará maneira de baixar e instalar com segurança
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Email pelo Cobol (AcuCobol)

El enlace que proporciona es para solucionar problemas de msmapi ocx. Tienes que tener msmapi instalado antes de que se creen errores o se pueda crear el archivo def. El ejemplo de MSMAPI está fechado, Outlook es un ensamblado de .Net ahora.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.