Skip to main content

[archive] Sending Emails from AcuGT

  • August 21, 2006
  • 14 replies
  • 0 views

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================

14 replies

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
This experience you are having is based on a bug in Microsoft Outlook.
http://support.microsoft.com/kb/196784
The MS Mapi library is using Outlook "under the hood" to do emails.
A quick search on the msdn suggests that prefixing email adresses with SMTP: will address this issue.
http://support.microsoft.com/kb/138053
If this will apply to, and work with the MSMAPI too, I don't know.
Here is a more extensive discussion of the issue:
http://support.microsoft.com/kb/290809
Note that if you take the burden of changing the standard email format for the specific user or all users in Outlook, you will also be able to circumvent the problem.
Finally, if you have access to an smtp server, send your emails using c$socket. :-)

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
I am keen to be able to send emails and attachments from ACuGT. I can produce invoices, statements and other reports as .PDF files, and would like to be able to send these as an email and attachment. Problem is I do not know where to start with this, and as you seem to have solved this problem, any help or pointers would be appreciated.
Regards
Keith

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
We use an Active-X component called EasyMail see (http://www.quiksoft.com/objects). It allows us to quickly create both plain text and html emails with attachments. The email can then be send directly to an SMTP server, I think it supports MAPI also.

Richard

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
Richard

Thanks for the info, I will check out their web site although I would have preferred to have used a simpler mechanism as my requirements are in fact very simple?

I have also seen a 'sendmail.cbl' in the forum that uses c$socket - it works fine for sending emails, BUT I have no idea how to get it to make an attachment.

Regards
Keith

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
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 "Recipient name" TO MY-RECIP-NAME.
MOVE "Recipient email" 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 want to send an attachment, uncomment the next lines,
* Change "Absolute file path here" to the absolute path of your
* file, for instance: "c:\\acucorp\\mydirectory\\myprogram.cbl"
*
* 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.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
Here is the code for those who want to send emails with attachment using C$SOCKET and SMTP.

Mind you, to send emails using C$Socket, it is required with an smtp server.

Courtesy KISS GmbH, Germany.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
An update to my problem.
I've tried a number of settings for the strings passed in the MapiFileTagExt structure used to define attachments. Nothing has worked.

I have tried setting the properties of my Outlook profile to "Plain Text", and I have set up the receiving party in my Contact list and set their profile to "Plain Text". The attachments are still being received as a single file called WINMAIL.DAT.

The approach I am going to take is to provide logic so that when an email address in my system is prefixed as LN:email_address.com, then for the recipient I'll build a command line and make a SYSTEM call to execute a third party email program from a DOS prompt.

Thanks for everyone's input.

PS For anyone that wants to send email and/or who is in the early stages of re-engineering their software for GUI, Sentinel Hill Software has a robust set of COBOL libraries to build GUI applications.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
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 "Recipient name" TO MY-RECIP-NAME.
MOVE "Recipient email" 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 want to send an attachment, uncomment the next lines,
* Change "Absolute file path here" to the absolute path of your
* file, for instance: "c:\\acucorp\\mydirectory\\myprogram.cbl"
*
* 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.


This is the exact program that I am using. It works perfectly for me with Outlook Express but when I use it with Outlook, it puts the messages in the Outbox without a "from" address. I have re-installed Outlook and verified the setup of the default profile - but nothing I do will make it pick up the "from" address. Any suggestions?

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
I believe what you experience has to do with the sending account and the logged on domain.

See my post in another thread.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
Hi,

I am new to the forum and am trying to send emails through my cobol program. I dowloaded the cobolmail.zip file but am having trouble compiling the winbmail program with our current Acubench 7.2. I'm getting errors in my acucobol.def file. Is there a 7.2 version? Any help would be greatly appreciated.

Len Sawyer

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
The def file hasn't changed in awhile, it is probably your AcuBench project settings. Open up your project in AcuBench, go to the project settings, click on the environment tab, highlight the COPYPATH variable, in the "Value" entry field use the browse button to navigate to the directory that contains the sample def files. Click OK to save the project settings and compile again.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
Thanks! It looks like It was copied into the program twice. It complies now.

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
When I run winbmail (from testmail), I get a successful email sent the first time through. When I try it again a second time, the program hangs. Has this been an issue that has been adressed somewhere on the forums?

[Migrated content. Thread originally posted on 18 August 2006]

I have this subroutine written in AcuCOBOL that sends emails with attachments.

Its using the Simple MAPI calls available in MAPI.DLL

It works just fine.
I can send email versions of all reports that are generated in my applications.
I can send A/R Statements to Customers.
I can send Bulk Email to all A/R Customers and all A/P Vendors
I can send Invoices from my Invoice system
It is a very useful routine.

It is set up to handle up to 3 attachments.

Up till recently, the recipients of the emails have always been using Outlook, and they have always been able to correctly open any attachments sent as Word or Excel documents.

Now the problem ???????

It seems that if the recipient is using Lotus Notes as their email client, the attachments cannot be opened.

The attachments are being renamed to WINMAIL.DAT and are being decoded incorrectly.

I know this may not be directly be an Acucobol problem, but I?m running out of options in figuring out how this is supposed to be coded properly.

I?ve spent hours scanning the MSDN web site reading through documentation on Simple MAPI.

I believe the problem is related to the use of the packets used to define the attachments.

I need to be able to specify the Type of Attachment and it?s Encoding by populating the following structures:

* ----------------------------------------------

* The [MapiFileDesc] structure contains information about file(s) containing a message attachment stored as a temporary file.

* The file can contain a static or embedded OLE object, an embedded message, or other types of files.

* Up to 3 attachments may be defined

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG flFlags; - set MAPI_OLE and/or MAPI_OLE_STATIC as an embedded or static OLE Object

* ULONG nPosition; - An integer indicating the position in the message that the attachment is placed

* A value of -1 a position is not indicated.

* LPTSTR lpszPathName; - Pointer to text string containing the fully qualified path to attatched file.

* LPTSTR lpszFileName; - Pointer to attachment filename as seen by the recipient. (It may differ of may be NULL)

* LPVOID lpFileType; - Pointer to attachment file type MapiFileTagExt structure.

* NULL indicates an unknown file type or a type to be determined by op system.

* } MapiFileDesc, FAR *lpMapiFileDesc;

*



And ?..



* ----------------------------------------------

* The [MapiFileTagExt] structure specifies a message attachment's type at it's creation and it's current form of encoding

* so it can be restored to it's original type at its destination.

*

* MAPI C original struct

* typedef struct {

* ULONG ulReserved; - Must be ZERO

* ULONG cbTag; - the size in bytes of the value defined by lpTag

* LPBYTE lpTag; - Pointer to an X.400 object identifier indicating type of attachment in its original form

* ULONG cbEncoding; - the size in bytes of the value defined by lpEncoding

* LPBYTE lpEncoding; - Pointer to an X.400 object identifier indicating the form which the attachment is encoded

* } MapiFileTagExt, FAR *lpMapiFileTagExt;

*

In particular, I?m trying to find out how to set up the lpTag and lpEncoding identifiers.

In my program now I have the lpTag pointing to a working storage that contains the following:


01 TAG-FILE-TYPE PIC X(35) VALUE '?Microsoft Excel worksheet"'.

And the lpEncoding pointing to working storages that contains the following:

01 ENCODING-TYPE PIC X(10) VALUE "binary".


I?m really not sure if these are the values that are supposed to be set as I cannot find documentation on the X.400 object identifiers as to what are valid types of attachments and encoding methods.


I've tried Binary and Base64 but both get the same result.


=======================================================
This is a long shot trying this Customer Forum.
I hope it works.
========================================================
I can use winbmail to send text documents, but PDF files get damaged. Can winbmail send binary attachments?