Sample code for 30+ languages & platforms
PowerShell

Transition from MailMan.GetSmtpSslServerCert to MailMan.GetServerCert

Provides instructions for replacing deprecated GetSmtpSslServerCert method calls with GetServerCert.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$mailman = New-Object Chilkat.MailMan

# ...
# ...

# ------------------------------------------------------------------------
# The GetSmtpSslServerCert method is deprecated:

$certObj = $mailman.GetSmtpSslServerCert()
if ($mailman.LastMethodSuccess -eq $false) {
    $($mailman.LastErrorText)
    exit
}

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using GetServerCert.
# Your application creates a new, empty Cert object which is passed 
# in the last argument and filled upon success.

# We want the SMTP email server certificate..
$useSmtp = $true

$certOut = New-Object Chilkat.Cert
$success = $mailman.GetServerCert($useSmtp,$certOut)
if ($success -eq $false) {
    $($mailman.LastErrorText)
    exit
}