title: Special character in Email Address throwing Exception
body: <p>I have to send email to users using JavaMail API.</p>
  
  <p>User may have email address with apostrophe some like</p>
  
  <pre><code> Michael.O’Hara@sampleDomain.com 
  </code></pre>
  
  <p>I am getting below exception when I try to send an email to such a user.</p>
  
  <pre><code>    javax.mail.MessagingException: Can't send command to SMTP host;
    nested exception is:
      java.net.SocketException: Software caused connection abort: socket write error
      at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1564)
      at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1551)
      at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:696)
      at javax.mail.Transport.send0(Transport.java:191)
      at javax.mail.Transport.send(Transport.java:118)
      at com.openpages.ext.duke.util.DukeEmailUtil.sendNotification(DukeEmailUtil.java:194)
  </code></pre>
  
  <p>Following is the method that I am using to send email</p>
  
  <pre><code>public static void sendNotification(String mailServer, String fromName,
              String fromAddress, String toAddress, String ccAddresses,
              String subject, String emailContent) throws Exception {
          try {
  
              // TODO: The email session should be cached in a future release.
              Properties props = new Properties();
              props.put("mail.smtp.host", mailServer);
  
              Session session = Session.getInstance(props, null);
              MimeMessage msg = new MimeMessage(session);
              InternetAddress addressFrom = null;
              if (StringUtil.isGood(fromName))
                  addressFrom = new InternetAddress(fromAddress, fromName);
              else
                  addressFrom = new InternetAddress(fromAddress);
              msg.setFrom(addressFrom);
  
              if (toAddress != null &amp;&amp; !toAddress.equalsIgnoreCase("")) {
                  String[] toAddressesArray = toAddress.split(";");
                  InternetAddress[] addressTO = new InternetAddress[toAddressesArray.length];
                  for (int i = 0; i &lt; toAddressesArray.length; i++) {
                      LoggerFactory.getLogger().error("Before InternetAdress Contructor");
                      addressTO[i] = new InternetAddress(toAddressesArray[i]);
                      LoggerFactory.getLogger().error("After InternetAdress Contructor");
  
                  }
                  msg.setRecipients(Message.RecipientType.TO, addressTO);
              }
  
              // TODO : method signature has to be changed
              // to take String[] for toAddress &amp; ccAddresses
              if (ccAddresses != null &amp;&amp; !ccAddresses.equalsIgnoreCase("")) {
                  String[] ccAddressesArray = ccAddresses.split(";");
                  InternetAddress[] addressCC = new InternetAddress[ccAddressesArray.length];
                  for (int i = 0; i &lt; ccAddressesArray.length; i++) {
                      addressCC[i] = new InternetAddress(ccAddressesArray[i]);
                  }
                  msg.setRecipients(Message.RecipientType.CC, addressCC);
              }
  
              msg.setSubject(subject, "utf-8");
              msg.setContent(emailContent, "text/html;charset=utf-8");
              Transport.send(msg);
  
              msg = null;
              session = null;
          }
  
          catch (Exception e) {
              e.printStackTrace();
              throw e;
          }
      }
  </code></pre>
  
  <p>If anyone can tell me how to fix this, that will be great.  </p>