Q:

Java : Java mail garbling the email-subject. 

I am sending out an email pro-grammatically, but the subject in email is getting garbled(posted below).  Can anyone tell me what I am doing wrong.  Thanks a lot. 
Code to send email :
final String from = "from@gmail.com";
        final String emailPassword = "password";
        final String to = "somemail@gmail.com";
        final String ccMail = "ccmail@gmail.com";
        String[] mailAddressTo = new String[2];
        mailAddressTo[0] = to;
        mailAddressTo[1] = ccMail;

        InternetAddress[] mailAddress_TO = new InternetAddress[mailAddressTo.length];

        for (int i = 0; i < mailAddressTo.length; i++)
        {
            try {
                mailAddress_TO[i] = new InternetAddress(mailAddressTo[i]);
            } catch (AddressException ignored) {          }
        }

        Properties props = new Properties();
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.host", "");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.port", "25");

        Session session = Session.getDefaultInstance(props,
                new javax.mail. Authenticator(){
                    protected PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication(
                                from, emailPassword);
                    }
                });
        try {
            MimeMessage message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            message.addRecipient(Message. RecipientType. TO,new InternetAddress(to));
            message.addRecipients(Message. RecipientType. TO, mailAddress_TO);
            message.setSubject("Es hat sich jemand für einen Kurs eingeschrieben");
            String messageText = "some text";
            message.setContent(messageText,"text/html;charset=UTF-8");
            Transport.send(message);
        } catch (MessagingException e) {
            e.printStackTrace();
        }
    }

Subject output :
=? ANSI_X3.4-1968?Q?Es_hat_sich_jemand_f=3Fr_einen_Kurs_eingeschrieben?=

The above output I am getting in mail-client and in browsers as well.  What am I doing wrong?  

A:

This seems to be a problem with the used character set.  To test this you could try to set the Character Encoding in your source code:
    System.setProperty("mail.mime.charset","Cp1252");

I think the JavaMail API checks some properties but I can't remember wich ones.