Address address = null;  if (name != null && name != Undefined.instance) { address = new InternetAddress(addstr, MimeUtility.encodeWord(name.toString())); } else { address = new InternetAddress(addstr); }  message.setFrom(address);
    public void setFrom(String addstr, Object name) throws Exception {        if (addstr.indexOf("@") < 0) {            throw new AddressException();        }        Address address = null;        if (name != null && name != Undefined.instance) {            address = new InternetAddress(addstr,                                          MimeUtility.encodeWord(name.toString()));        } else {            address = new InternetAddress(addstr);        }        message.setFrom(address);    }