PowerShell
PowerShell
Transition from MailMan.FetchByMsgnum to MailMan.FetchOne
Provides instructions for replacing deprecated FetchByMsgnum method calls with FetchOne.Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$mailman = New-Object Chilkat.MailMan
# ...
# ...
$msgnum = 123
# ------------------------------------------------------------------------
# The FetchByMsgnum method is deprecated:
$emailObj = $mailman.FetchByMsgnum($msgnum)
if ($mailman.LastMethodSuccess -eq $false) {
$($mailman.LastErrorText)
exit
}
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using FetchOne.
# Your application creates a new, empty Email object which is passed
# in the last argument and filled upon success.
$headerOnly = $false
# Irrelevant because we are not downloading headers-only.
$numBodyLines = 0
$emailOut = New-Object Chilkat.Email
$success = $mailman.FetchOne($headerOnly,$numBodyLines,$msgnum,$emailOut)
if ($success -eq $false) {
$($mailman.LastErrorText)
exit
}