(PowerShell) Transition from MailMan.LoadEml to Email.LoadEml
Provides instructions for replacing deprecated MailMan.LoadEml method calls with Email.LoadEml. Note: This example requires Chilkat v11.0.0 or greater.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$mailman = New-Object Chilkat.MailMan
# ...
# ...
$filePath = "c:/dir/example.eml"
# ------------------------------------------------------------------------
# The MailMan.LoadEml method is deprecated:
$emailObj = $mailman.LoadEml($filePath)
if ($mailman.LastMethodSuccess -eq $false) {
$($mailman.LastErrorText)
exit
}
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using Email.LoadEml.
$email = New-Object Chilkat.Email
$success = $email.LoadEml($filePath)
if ($success -eq $false) {
$($email.LastErrorText)
exit
}
|