Sample code for 30+ languages & platforms
Java

Transition from MailMan.GetSmtpSslServerCert to MailMan.GetServerCert

Provides instructions for replacing deprecated GetSmtpSslServerCert method calls with GetServerCert.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkMailMan mailman = new CkMailMan();

    //  ...
    //  ...

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

    CkCert certObj = mailman.GetSmtpSslServerCert();
    if (mailman.get_LastMethodSuccess() == false) {
        System.out.println(mailman.lastErrorText());
        return;
        }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  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..
    boolean useSmtp = true;

    CkCert certOut = new CkCert();
    success = mailman.GetServerCert(useSmtp,certOut);
    if (success == false) {
        System.out.println(mailman.lastErrorText());
        return;
        }
  }
}