CkJava Requires Chilkat v11.0.0+
CkJava
Request quoted-printable for text alternatives
See more Email Object Examples
Use this when a receiving system requires quoted-printable. The MIME charset describes the text encoding. Content-Transfer-Encoding describes how those bytes travel in a message. Inspect the rendered text parts for the encoding and the escaped equals sign.
Chilkat CkJava 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;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
CkEmail email = new CkEmail();
email.put_From("Workshop team <events@example.com>");
success = email.AddTo("Alex Rivera","alex@example.net");
if (success != true) {
System.out.println(email.lastErrorText());
return;
}
email.put_Subject("Workshop registration");
success = email.AddPlainTextAlternativeBody("Workshop code = A42");
if (success != true) {
System.out.println(email.lastErrorText());
return;
}
success = email.AddHtmlAlternativeBody("<p>Workshop code = A42</p>");
if (success != true) {
System.out.println(email.lastErrorText());
return;
}
email.AddHeaderField("Content-Transfer-Encoding","quoted-printable");
CkMailMan mail = new CkMailMan();
CkStringBuilder text = new CkStringBuilder();
success = mail.RenderToMimeSb(email,text);
if (success != true) {
System.out.println(mail.lastErrorText());
return;
}
System.out.println(text.getAsString());
}
}