C++ MAPI: MAPILogonEx, how to open default mail in

2019-03-02 11:58发布

问题:

I want to login to my default mail inbox via:

MAPILogonEx(0, profileName, NULL, MAPI_LOGON_UI, &lpMAPISession)

where I defined profileName as:

LPTSTR profileName = _T("Default");

However this doesn't work and tells me that I supplied an invalid profilename.

What would be the correct value for the variable profileName to login to the default mail inbox?

回答1:

Its actually really easy once you know... but you can also waste half a day on it..

Just call:
MAPILogonEx(0, 0, NULL, MAPI_LOGON_UI | MAPI_USE_DEFAULT , &lpMAPISession);

I'm still unable to supply a profilename but the default one will do the trick for now.



标签: c++ email mapi