How to find the incoming mail's language charset using MAPI on

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Sat, 30 Jul 2005 16:11:03


Thank you very much for your immediate reply.

Can you give a rough code snippet with PR_INTERNET_CPID?
I searched in google and MSDN. But I didnt get any help.

Once again thank you for your reply.

Best regards,
--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.
 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Sun, 31 Jul 2005 04:22:46

am not sure what you mean: you need to read it the same way you read other
properties in your code (e.g. PR_SUBJECT).
PR_INTERNET_CPID will give you an integer identifier of the code page.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Tue, 02 Aug 2005 14:36:01

i Dmitry Streblechenko,

When I added "PR_INTERNET_CPID" to properties list, immediately I am
getting this error. How can I resolve this error?
error C2065: 'PR_INTERNET_CPID' : undeclared identifier


I tried with this below code. But I can't get the internet code page id. How?

#ifndef PR_INTERNET_CPID
#define PR_INTERNET_CPID (PROP_TAG(PT_LONG,0x3FDE0003))
#endif

HRESULT hRes = HrGetOneProp(lpMessage, PR_INTERNET_CPID, &lpPropCPID);
if (SUCCEEDED(hRes))
{
MessageBox(NULL,"Succ...","Internet Code Page",MB_OK);
}
else
{
MessageBox(NULL,"Fail...","Internet Code Page",MB_OK);
}

With this code snippet, I am getting always fail only. How can I sove?

Thanks in advance.

Best regards,

--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.


"Dmitry Streblechenko" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Wed, 03 Aug 2005 00:01:02

How to get the body(non-english characters) of incoming mail if it has
unicode characters?

Plz explain with a small code snippet if possible.

Thanks in advance.
--
DKDS.Naidu,
Programmer Analyst.



"Dkds.Naidu" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Wed, 03 Aug 2005 02:24:47

he prop tag must be declared either as
define PR_INTERNET_CPID (PROP_TAG(PT_LONG,0x3FDE));
or as
define PR_INTERNET_CPID 0x3FDE0003;

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Wed, 03 Aug 2005 02:26:41

f the store supports Unicode natively, read the Unicode version of PR_BODY
(PR_BODY_W). Otherwise you would need to convert the RTF body (either pure
RTF or RTF wrapped HTML) to plain text. Creating a hidden RTF control,
streaming the RTF data in and then streaming plain text out will do the
trick.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Wed, 03 Aug 2005 19:51:02

hank you very much.

It works fine.


--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.


"Dmitry Streblechenko" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Thu, 04 Aug 2005 21:09:02

R_BODY_W and PR_SUBJECT_W are not working for Outlook 2000. These two are
failed.why?

Any other proerties are there are for getting unicode data of a mail?

How to solve this problem?

Thanks in advance.


--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.


"Dmitry Streblechenko" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Fri, 05 Aug 2005 02:54:05

ecause Outlook 2000 does not natively support Unicode. Once again, the body
must be converted from PR_RTF_COMPRESSED.
For the subject, if the STORE_UNICODE_OK bit is missing from the
PR_STORE_SUPPORT_MASK property (meaning there is no native Unicode support),
read PR_SUBJECT_A and call MultibyteToWideChar using the value of the
PR_INTERNET_CPID property as a code page.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Fri, 05 Aug 2005 22:45:04

Thank you for giving suggestions.

I tried with below code. PR_RTF_COMRESSED has two copies of same data. why
it has two copies? after getting PR_RTF_COMPRESSED data, how can I get
UNICODE data from this?


I got the long value of PR_STORE_SUPPORT_MASK.It has 14333.How can I set
SUPPORT_UNICODE_OK to store?


Can you explain with rough code?

// lpExchangeCallback->GetObject(&lpMdb, (LPMAPIPROP*)&lpMessage)


LPSTREAM istream = NULL;
hRes = lpMessage->OpenProperty(PR_RTF_COMPRESSED, &IID_IStream, STGM_READ,
NULL, (IUnknown**)&istream);
if (SUCCEEDED(hRes))
{
IStream *iunstream;
hRes = WrapCompressedRTFStream(istream,0,&iunstream);
char szBuf [10240];
char szTemp[10240];
ULONG ulNumChars = 0;
CString strRTF;
do
{
iunstream->Read(szBuf,100000,&ulNumChars);
if (ulNumChars >0)
{
sprintf(szTemp,"%.*s",ulNumChars,szBuf);
}
strRTF += szTemp;
}while (ulNumChars >= 10240);
if (istream) istream->Release();
if (iunstream) iunstream->Release();
}

FILE* fp = fopen("C:\\output.txt","a+");
fprintf(fp,"%s",strRTF);
fclose(fp);

///
//

output.txt has: (of empty mail)


{\rtf1\ansi\ansicpg1252\fromhtml1 \deff0{\fonttbl

{\f0\fswiss\fcharset0 Arial;}

{\f1\fmodern Courier New;}

{\f2\fnil\fcharset2 Symbol;}

{\f3\fmodern\fcharset0 Courier New;}}

{\colortbl\red0\green0\blue0;\red0\green0\blue255;}

\uc1\pard\plain\deftab360 \f0\fs24

{\*\htmltag243 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">}

{\*\htmltag3 \par }

{\*\htmltag19 <HTML>}

{\*\htmltag34 <HEAD>}

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag161 <META content="MSHTML 6.00.2800.1505" name=GENERATOR>}

{\*\htmltag41 </HEAD>}

{\*\htmltag2 \par }

{\*\htmltag50 <BODY>}

{\*\htmltag0 \par }

{\*\htmltag96 <DIV>}\htmlrtf {\htmlrtf0 {\*\htmltag64}\htmlrtf {\htmlrtf0

{\*\htmltag84 }\htmlrtf \'a0\htmlrtf0 {\*\htmltag72}\htmlrtf\par}\htmlrtf0



{\*\htmltag104 </DIV>}\htmlrtf }\htmlrtf0

{\*\htmltag58 </BODY>}

{\*\htmltag27 </HTML>}

{\*\htmltag3 \par }

{\*\htmltag3 \par }

{\*\htmltag3 \par }}{\rtf1\ansi\ansicpg1252\fromhtml1 \deff0{\fonttbl
/*FROM HERE IT IS REPEATED SAME TEXT*/

{\f0\fswiss\fcharset0 Arial;}

{\f1\fmodern Courier New;}

{\f2\fnil\fcharset2 Symbol;}

{\f3\fmodern\fcharset0 Courier New;}}

{\colortbl\red0\green0\blue0;\red0\green0\blue255;}

\uc1\pard\plain\deftab360 \f0\fs24

{\*\htmltag243 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">}

{\*\htmltag3 \par }

{\*\htmltag19 <HTML>}

{\*\htmltag34 <HEAD>}

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag1 \par }

{\*\htmltag161 <META content="MSHTML 6.00.2800.1505" name=GENERATOR>}

{\*\htmltag41 </HEAD>}

{\*\htmltag2 \par }

{\*\htmltag50 <BODY>}

{\*\htmltag0 \par }

{\*\htmltag96 <DIV>}\htmlrtf {\htmlrtf0 {\*\htmltag64}\htmlrtf {\htmlrtf0

{\*\htmltag84 }\htmlrtf \'a0\htmlrtf0 {\*\htmltag72}\htmlrtf\par}\htmlrtf0



{\*\htmltag104 </DIV>}\htmlrtf }\htmlrtf0

{\*\htmltag58 </BODY>}

{\*\htmltag27 </HTML>}

{\*\htmltag3 \par }

{\*\htmltag3 \par }

{\*\htmltag3 \par }}

Thnaks in advance.

Best regards,
Dkds.Naidu.
 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Sat, 06 Aug 2005 00:12:13

reate a hidden RTF control, stream in the RTF data, then stream the data
out in plain text Unicode format.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Sat, 06 Aug 2005 23:09:02

i Dmitry,

How to create a hidden RTF control?

How to find STORE_UNICODE_OK supports store? If STORE_UNICODE_OK bit is
not there means, how to set this bit to PR_STORE_SUPPORT_MASK?

I tried with CRichEditCtrl and IHTMLDocument. But I stucked.


Please can you explain with rough code. I have the text of PR_RTF_COMPRESSED
property. How can I get the exact body of incoming mail either ascii or
non-ascii(UNICODE)?

Please explain with rough code.

Thanks in advance.


--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.


"Dmitry Streblechenko" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Sun, 07 Aug 2005 01:56:36

. You create it just like any other control - CreateWindowEx specifying the
appropriate control class (RICHEDIT_CLASSA) and make it a child of your own
(invisible) window to able able to receive notifications from the conttrols.
Use the (EM_STREAMIN, SF_RTF) message to send the RTF text to the control,
then use (EM_STREAMOUT, SF_TEXT | SF_UNICODE) to stream the plain text out.
Search for "RTF control" at http://www.codeproject.com/info/search.asp -
there are plenty of samples that should get you started.
2. Read the PR_STORE_SUPPORT_MASK (0x340D0003) property from any store
object (store, folder, message) and check if the STORE_UNICODE_OK bit
(0x00040000) is present
You cannot set the PR_STORE_SUPPORT_MASK, it is read-only. This is the way
for a store to advertise its capabilities.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

How to find the incoming mail's language charset using MAPI on

Post by RGtkcy5OYW » Sat, 13 Aug 2005 15:01:02

es Dmitry. You are right. I got the subject with UNICODE format.

I failed while getting body from PR_RTF_COMPRESSED.

I followed below steps:

1. Taken MFC support to my application.
2. Created one CDialog class. Dialog.h, Dialog.cpp files.(included rich edit
control over dialog box)
3. Created instance of CDialog class.AfxInitRichEdit().
4.Got the handle of RichEditControl.
5.SendMessage(,EM_STREAMIN,SF_RTF,EDITSTREAMstructurewithcallbackfunctionIN);
6.SendMessage(,EM_STREAMOUT,SF_TEXT|ST_UNICODE,EDITSTREAMstructurewithcallbackfunctionOUT);
While I am sending RTF text of html body, it fails. StreamINCallbackfunction
has infinite loop. I cant get the exact unicode data of incoming mails with
PR_RTF_COMPRESSED.
How?

Can I do with win 32?


Thanks in advance.

--
DKDS.Naidu,
Programmer Analyst,
ITPL - Bangalore.


"Dmitry Streblechenko" wrote:

 
 
 

How to find the incoming mail's language charset using MAPI on

Post by Dmitry Str » Sun, 14 Aug 2005 00:26:36

hat is your implementation of the callback? There is no way to even have a
guess unless you post your source code.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Dkds.Naidu" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...