Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Thu, 26 Jun 2008 08:12:05 +0200,    group: microsoft.public.platformsdk.mapi        back       


How to use MapiSendMail with MAPI_UNICODE?   
I was asked by a collegue to post the following question:

------------------------------------

Referring to <http://support.microsoft.com/?scid=kb;en-us;252627> I 
tried the code quoted below with Outlook 2003 (I expected Outlook 2003 
to support MAPI_UNICODE referring to 
<http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2004-10/0401.html>).

The Outlook mail editor pops up but unfortunately just displays a "t" 
(instead of "test ...") in the subject and the body edit control. It 
seems as if Outlook doesn't get that I am providing Unicode contents 
and stops at the first 0x00 ANSI character (being the lowbyte of the 
first Unicode character), despite of using the MAPI_UNICODE flag.

What am I doing wrong?



ULONG hParent = (ULONG)AfxGetMainWnd()->GetSafeHwnd();

LHANDLE hSession = NULL;

//ATTENTION: MAPI interface decl in <MAPI.H> always expects LPSTR 
types (even if content is UNICODE)

if (MapiLogon(hParent, (LPSTR) L"", (LPSTR) L"", 
MAPI_LOGON_UI|MAPI_UNICODE, 0, &hSession) == SUCCESS_SUCCESS)

{

MapiMessage Msg = {0};

Msg.lpszSubject = (LPSTR) L"test subject";

Msg.lpszNoteText = (LPSTR) L"test mail body";

Msg.flFlags = MAPI_UNICODE;

UINT32 nMAPIRet = MapiSendMail(hSession, hParent, &Msg, 
MAPI_DIALOG|MAPI_UNICODE, 0);

TRACE(_T("MAPISendMail returned %ld"), nMAPIRet);

MapiLogoff(hSession, hParent, 0, 0);

}
date: Thu, 26 Jun 2008 08:12:05 +0200   author:   Christian Kaiser

Re: How to use MapiSendMail with MAPI_UNICODE?   
Simple MPAI does not support Unicode.

-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Christian Kaiser"  wrote in message 
news:u17fQO11IHA.6112@TK2MSFTNGP02.phx.gbl...
>I was asked by a collegue to post the following question:
>
> ------------------------------------
>
> Referring to <http://support.microsoft.com/?scid=kb;en-us;252627> I
> tried the code quoted below with Outlook 2003 (I expected Outlook 2003
> to support MAPI_UNICODE referring to
> <http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2004-10/0401.html>).
>
> The Outlook mail editor pops up but unfortunately just displays a "t"
> (instead of "test ...") in the subject and the body edit control. It
> seems as if Outlook doesn't get that I am providing Unicode contents
> and stops at the first 0x00 ANSI character (being the lowbyte of the
> first Unicode character), despite of using the MAPI_UNICODE flag.
>
> What am I doing wrong?
>
>
>
> ULONG hParent = (ULONG)AfxGetMainWnd()->GetSafeHwnd();
>
> LHANDLE hSession = NULL;
>
> //ATTENTION: MAPI interface decl in <MAPI.H> always expects LPSTR
> types (even if content is UNICODE)
>
> if (MapiLogon(hParent, (LPSTR) L"", (LPSTR) L"",
> MAPI_LOGON_UI|MAPI_UNICODE, 0, &hSession) == SUCCESS_SUCCESS)
>
> {
>
> MapiMessage Msg = {0};
>
> Msg.lpszSubject = (LPSTR) L"test subject";
>
> Msg.lpszNoteText = (LPSTR) L"test mail body";
>
> Msg.flFlags = MAPI_UNICODE;
>
> UINT32 nMAPIRet = MapiSendMail(hSession, hParent, &Msg,
> MAPI_DIALOG|MAPI_UNICODE, 0);
>
> TRACE(_T("MAPISendMail returned %ld"), nMAPIRet);
>
> MapiLogoff(hSession, hParent, 0, 0);
>
> }
>
>
date: Fri, 27 Jun 2008 11:20:48 -0700   author:   Dmitry Streblechenko

Re: How to use MapiSendMail with MAPI_UNICODE?   
Thank you. No wonder he tells me it does not work...

Any UTF-8 capabilities?

Christian

"Dmitry Streblechenko"  wrote in message 
news:u1DUIKI2IHA.3756@TK2MSFTNGP04.phx.gbl...
> Simple MPAI does not support Unicode.
date: Tue, 1 Jul 2008 08:09:32 +0200   author:   Christian Kaiser

Re: How to use MapiSendMail with MAPI_UNICODE?   
That I don't know - I don't use Simple MAPI at all, sorry.

-- 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-
"Christian Kaiser"  wrote in message 
news:%23tDFJE02IHA.2424@TK2MSFTNGP04.phx.gbl...
> Thank you. No wonder he tells me it does not work...
>
> Any UTF-8 capabilities?
>
> Christian
>
> "Dmitry Streblechenko"  wrote in message
> news:u1DUIKI2IHA.3756@TK2MSFTNGP04.phx.gbl...
>> Simple MPAI does not support Unicode.
>
>
date: Tue, 1 Jul 2008 08:38:08 -0700   author:   Dmitry Streblechenko

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us