VBScript
VBScript
Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText
Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText.Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set mailman = CreateObject("Chilkat.MailMan")
' ...
' ...
xmlFilePath = "c:/test/example.xml"
' ------------------------------------------------------------------------
' The LoadXmlEmail method is deprecated:
' emailObj is a Chilkat.Email
Set emailObj = mailman.LoadXmlEmail(xmlFilePath)
If (mailman.LastMethodSuccess = 0) Then
outFile.WriteLine(mailman.LastErrorText)
WScript.Quit
End If
' ...
' ...
' ------------------------------------------------------------------------
' Do the equivalent using Email.SetFromXmlText.
set sb = CreateObject("Chilkat.StringBuilder")
success = sb.LoadFile(xmlFilePath,"utf-8")
If (success = 0) Then
outFile.WriteLine(sb.LastErrorText)
WScript.Quit
End If
set email = CreateObject("Chilkat.Email")
success = email.SetFromXmlText(sb.GetAsString())
If (success = 0) Then
outFile.WriteLine(email.LastErrorText)
WScript.Quit
End If
outFile.Close