Sample code for 30+ languages & platforms
Lianja

Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText

Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loMailman = createobject("CkMailMan")

// ...
// ...

lcXmlFilePath = "c:/test/example.xml"

// ------------------------------------------------------------------------
// The LoadXmlEmail method is deprecated:

loEmailObj = loMailman.LoadXmlEmail(lcXmlFilePath)
if (loMailman.LastMethodSuccess = .F.) then
    ? loMailman.LastErrorText
    release loMailman
    return
endif

// ...
// ...

release loEmailObj

// ------------------------------------------------------------------------
// Do the equivalent using Email.SetFromXmlText.

loSb = createobject("CkStringBuilder")
llSuccess = loSb.LoadFile(lcXmlFilePath,"utf-8")
if (llSuccess = .F.) then
    ? loSb.LastErrorText
    release loMailman
    release loSb
    return
endif

loEmail = createobject("CkEmail")
llSuccess = loEmail.SetFromXmlText(loSb.GetAsString())
if (llSuccess = .F.) then
    ? loEmail.LastErrorText
    release loMailman
    release loSb
    release loEmail
    return
endif



release loMailman
release loSb
release loEmail