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