Unicode C++
Unicode C++
Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText
Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText.Chilkat Unicode C++ Downloads
#include <CkMailManW.h>
#include <CkEmailW.h>
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
bool success = false;
CkMailManW mailman;
// ...
// ...
const wchar_t *xmlFilePath = L"c:/test/example.xml";
// ------------------------------------------------------------------------
// The LoadXmlEmail method is deprecated:
CkEmailW *emailObj = mailman.LoadXmlEmail(xmlFilePath);
if (mailman.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",mailman.lastErrorText());
return;
}
// ...
// ...
delete emailObj;
// ------------------------------------------------------------------------
// Do the equivalent using Email.SetFromXmlText.
CkStringBuilderW sb;
success = sb.LoadFile(xmlFilePath,L"utf-8");
if (success == false) {
wprintf(L"%s\n",sb.lastErrorText());
return;
}
CkEmailW email;
success = email.SetFromXmlText(sb.getAsString());
if (success == false) {
wprintf(L"%s\n",email.lastErrorText());
return;
}
}