(C#) Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText
Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText. Note: This example requires Chilkat v11.0.0 or greater.
Chilkat.MailMan mailman = new Chilkat.MailMan();
// ...
// ...
string xmlFilePath = "c:/test/example.xml";
// ------------------------------------------------------------------------
// The LoadXmlEmail method is deprecated:
Chilkat.Email emailObj = mailman.LoadXmlEmail(xmlFilePath);
if (mailman.LastMethodSuccess == false) {
Debug.WriteLine(mailman.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using Email.SetFromXmlText.
Chilkat.StringBuilder sb = new Chilkat.StringBuilder();
bool success = sb.LoadFile(xmlFilePath,"utf-8");
if (success == false) {
Debug.WriteLine(sb.LastErrorText);
return;
}
Chilkat.Email email = new Chilkat.Email();
success = email.SetFromXmlText(sb.GetAsString());
if (success == false) {
Debug.WriteLine(email.LastErrorText);
return;
}
|