(VB.NET) 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.
Dim mailman As New Chilkat.MailMan
' ...
' ...
Dim xmlFilePath As String = "c:/test/example.xml"
' ------------------------------------------------------------------------
' The LoadXmlEmail method is deprecated:
Dim emailObj As Chilkat.Email = mailman.LoadXmlEmail(xmlFilePath)
If (mailman.LastMethodSuccess = False) Then
Debug.WriteLine(mailman.LastErrorText)
Exit Sub
End If
' ...
' ...
' ------------------------------------------------------------------------
' Do the equivalent using Email.SetFromXmlText.
Dim sb As New Chilkat.StringBuilder
Dim success As Boolean = sb.LoadFile(xmlFilePath,"utf-8")
If (success = False) Then
Debug.WriteLine(sb.LastErrorText)
Exit Sub
End If
Dim email As New Chilkat.Email
success = email.SetFromXmlText(sb.GetAsString())
If (success = False) Then
Debug.WriteLine(email.LastErrorText)
Exit Sub
End If
|