Java
Java
Transition from Imap.FetchSingle to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.Chilkat Java Downloads
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;
CkImap imap = new CkImap();
// ...
// ...
// ------------------------------------------------------------------------
// The FetchSingle method is deprecated:
CkEmail emailObj = imap.FetchSingle(1,false);
if (imap.get_LastMethodSuccess() == false) {
System.out.println(imap.lastErrorText());
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using FetchEmail.
// Your application creates a new, empty Email object which is passed
// in the last argument and filled upon success.
boolean headerOnly = false;
CkEmail email = new CkEmail();
success = imap.FetchEmail(headerOnly,1,false,email);
if (success == false) {
System.out.println(imap.lastErrorText());
return;
}
}
}