title: Java : Java mail garbling the email-subject.
body: <p>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.</p>
  
  <p>Code to send email :</p>
  
  <pre><code>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 &lt; 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();
          }
      }
  </code></pre>
  
  <p>Subject output :</p>
  
  <pre><code>=?ANSI_X3.4-1968?Q?Es_hat_sich_jemand_f=3Fr_einen_Kurs_eingeschrieben?=
  </code></pre>
  
  <p>The above output I am getting in mail-client and in browsers as well. What am I doing wrong? </p>