Where can I find a detailed code example of sending non-ASCII messages (Japanese in my case)?

John Zukowski

You need to be sure to set the character set when you set the content. The following example demonstrates. The message content is the numbers from 1-10.

import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendJIS {
  public static void main (String args[]) throws Exception {
    String host = args[0];
    String from = args[1];
    String to = args[2];

    // Get system properties
    Properties props = System.getProperties();

    // Setup mail server
    props.put("mail.smtp.host", host);

    // Get session
    Session session = Session.getInstance(props, null);

    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
      new InternetAddress(to));
    message.setSubject("Hello JIS JavaMail");

    String jisText = 

    message.setContent(jisText, "text/plain; charset=JIS");

    // Send message
For some reason this only displays 1-6 okay as far as the content. I don't know why 7-10 is messed up. As I don't use Japanese that much, it could be my configuration.