Sample code for 30+ languages & platforms
Swift

Transition from MailMan.GetSmtpSslServerCert to MailMan.GetServerCert

Provides instructions for replacing deprecated GetSmtpSslServerCert method calls with GetServerCert.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let mailman = CkoMailMan()!

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The GetSmtpSslServerCert method is deprecated:

    var certObj: CkoCert? = mailman.getSmtpSslServerCert()
    if mailman.lastMethodSuccess == false {
        print("\(mailman.lastErrorText!)")
        return
    }

    // ...
    // ...

    certObj = nil

    // ------------------------------------------------------------------------
    // 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..
    var useSmtp: Bool = true

    let certOut = CkoCert()!
    success = mailman.getServerCert(useSmtp: useSmtp, cert: certOut)
    if success == false {
        print("\(mailman.lastErrorText!)")
        return
    }


}