List of usage examples for javax.mail.internet MimeUtility encodeText
public static String encodeText(String text) throws UnsupportedEncodingException
From source file:org.wf.dp.dniprorada.util.Mail.java
public Mail _Attach(URL oURL, String sName) { try {// ww w . j a v a 2 s . com MimeBodyPart oMimeBodyPart = new MimeBodyPart();//javax.activation oMimeBodyPart.setHeader("Content-Type", "multipart/mixed"); DataSource oDataSource = new URLDataSource(oURL); oMimeBodyPart.setDataHandler(new DataHandler(oDataSource)); //oPart.setFileName(MimeUtility.encodeText(source.getName())); oMimeBodyPart.setFileName( MimeUtility.encodeText(sName == null || "".equals(sName) ? oDataSource.getName() : sName)); oMultiparts.addBodyPart(oMimeBodyPart); log.info("[_Attach:oURL]:sName=" + sName); } catch (Exception oException) { log.error("[_Attach:oURL]:sName=" + sName, oException); } return this; }