Java
Java
Transition from MailMan.CopyMail to MailMan.FetchAll
Provides instructions for replacing deprecated CopyMail method calls with FetchAll.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;
CkMailMan mailman = new CkMailMan();
// ...
// ...
// ------------------------------------------------------------------------
// The CopyMail method is deprecated:
CkEmailBundle bundleObj = mailman.CopyMail();
if (mailman.get_LastMethodSuccess() == false) {
System.out.println(mailman.lastErrorText());
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using FetchAll.
// Your application creates a new, empty EmailBundle object which is passed
// in the last argument and filled upon success.
boolean keepOnServer = true;
boolean headersOnly = false;
// Irrelevent because we are not downloading headers-only.
int numBodyLines = 0;
CkEmailBundle bundleOut = new CkEmailBundle();
success = mailman.FetchAll(keepOnServer,headersOnly,numBodyLines,bundleOut);
if (success == false) {
System.out.println(mailman.lastErrorText());
return;
}
}
}