Link to home
Start Free TrialLog in
Avatar of Cmustaffa
Cmustaffa

asked on

SImple MAPI use of attached files

My question deals with using the Simple MAPI function,
MAPISendMail in Visual C++ 5.0.  Within the MapiMessage struct
there is the following member;
lpMapiFileDesc - Pointer to an array of MapiFileDesc structures,
each containing information about a file attachment.
Within the MapiFileDesc there is the following pointer,
lpFileType - Pointer to the attachment file type,
which can be represented with a MapiFileTagExt structure.  
Within the MapiFileTagExt struct there are the following members;

cbTag - The size, in bytes, of the value defined by the lpTag member.

lpTag - Pointer to an X.400 object identifier indicating the type of the attachment
in its original form, for example "Microsoft Excel worksheet".

cbEncoding - The size, in bytes, of the value defined by the lpEncoding member.

lpEncoding - Pointer to an X.400 object identifier indicating the form in which
the attachment is currently encoded, for example MacBinary, UUENCODE, or binary.

Now my question, where do I find the values/data for the above.
These are X.400 Object IDs or OIDs.  I need an example on for
attaching a standard .txt file that can be viewed in
Notepad.  My attachment is unreadalbe when opened from a browser.
Avatar of cdesigner
cdesigner
Flag of Russian Federation image

you look in this file MAPITAGS.H ?
Avatar of Cmustaffa
Cmustaffa

ASKER

Yes, I've looked in MAPITAGS.H.  I think MAPIOID.H contains a few OIDs
but I not sure how to use them.  Those
fields require X.400 OIDs. The OID
fields are defined as LPBYTE and the
lengths as ULONG.  But the length fields
give an example of "Microsoft Excel worksheet", do I get the lenght with this;
char szFileType = "Microsoft Excel..";
ULONG uLength = strlen(szFileType);
LPBYTE pFileType = X.400 OID for Excel?
may be this way?
I find this in msdn



MapiFileTagExt (Simple MAPI)
A MapiFileTagExt structure specifies a message attachment's type at its creation and its current form of encoding so that it can be restored to its original type at its destination.

Quick Info
Header file: MAPI.H


typedef struct {
     ULONG ulReserved;
     ULONG cbTag;
     LPBYTE lpTag;
     ULONG cbEncoding;
     LPBYTE lpEncoding
} MapiFileTagExt, FAR *lpMapiFileTagExt;
 
You didn't answer the question!  What
are the values that are used in the following fields;
ULONG cbTag;
LPBYTE lpTag;
ULONG cbEncoding;
LPBYTE lpEncoding
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Alex, I can get the attachment to correctly detach if the recipient is
using MS OutLook, i.e., the attactment
appear as a Notepad icon at the bottom
of the file.  The problem is when I email the attachment with the name;
SMTP:anyname@hotmail.com or anyname@aol.com or to any non-MS mailer
program the attachment appears as "Unknown" file type in aol and detaches
as garbage in hotmail. I think these environments need the X.400 OID tags
to properly decode and detach the .txt
files.  I found the X.400 OIDs on the Internet for Microsoft's file formats
and the mapioid.h contains a few OIDs,
but trying to use the macros to create
an OID BYTE tag generated errors. I \
believe that the MapiFileTagExt struct
is used for non-MS environments, why else would it be included?  Thanks for
input.
P.S. I found nothing on MSDN or KB KB