/** * Creates a MimePart from text part. * * @return mimePart from HTML string * @throws MessagingException */ private MimePart createTextMimePart() throws MessagingException { MimePart bodyPart = new MimeBodyPart(); bodyPart.setText(textPart); return bodyPart; }
/** * Set the content for a part using the encoding assigned to the handler. * @param part the part to assign. * @param buf the formatted data. * @param type the mime type or null, meaning text/plain. * @throws MessagingException if there is a problem. */ private void setContent(MimePart part, CharSequence buf, String type) throws MessagingException { final String charset = getEncodingName(); if (type != null && !"text/plain".equalsIgnoreCase(type)) { type = contentWithEncoding(type, charset); try { DataSource source = new ByteArrayDataSource(buf.toString(), type); part.setDataHandler(new DataHandler(source)); } catch (final IOException IOE) { reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE); part.setText(buf.toString(), charset); } } else { part.setText(buf.toString(), MimeUtility.mimeCharset(charset)); } }
bodyPart.setContent(body, type); } else { bodyPart.setText(body.toString());
((MimePart) primary).setText(msg, charset);
/** * Set the content for a part using the encoding assigned to the handler. * @param part the part to assign. * @param buf the formatted data. * @param type the mime type or null, meaning text/plain. * @throws MessagingException if there is a problem. */ private void setContent(MimePart part, CharSequence buf, String type) throws MessagingException { final String charset = getEncodingName(); if (type != null && !"text/plain".equalsIgnoreCase(type)) { type = contentWithEncoding(type, charset); try { DataSource source = new ByteArrayDataSource(buf.toString(), type); part.setDataHandler(new DataHandler(source)); } catch (final IOException IOE) { reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE); part.setText(buf.toString(), charset); } } else { part.setText(buf.toString(), MimeUtility.mimeCharset(charset)); } }
/** * Set the content for a part using the encoding assigned to the handler. * @param part the part to assign. * @param buf the formatted data. * @param type the mime type or null, meaning text/plain. * @throws MessagingException if there is a problem. */ private void setContent(MimePart part, CharSequence buf, String type) throws MessagingException { final String charset = getEncodingName(); if (type != null && !"text/plain".equalsIgnoreCase(type)) { type = contentWithEncoding(type, charset); try { DataSource source = new ByteArrayDataSource(buf.toString(), type); part.setDataHandler(new DataHandler(source)); } catch (final IOException IOE) { reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE); part.setText(buf.toString(), charset); } } else { part.setText(buf.toString(), MimeUtility.mimeCharset(charset)); } }
/** * Set the content for a part using the encoding assigned to the handler. * @param part the part to assign. * @param buf the formatted data. * @param type the mime type or null, meaning text/plain. * @throws MessagingException if there is a problem. */ private void setContent(MimePart part, CharSequence buf, String type) throws MessagingException { final String charset = getEncodingName(); if (type != null && !"text/plain".equalsIgnoreCase(type)) { type = contentWithEncoding(type, charset); try { DataSource source = new ByteArrayDataSource(buf.toString(), type); part.setDataHandler(new DataHandler(source)); } catch (final IOException IOE) { reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE); part.setText(buf.toString(), charset); } } else { part.setText(buf.toString(), MimeUtility.mimeCharset(charset)); } }
/** * Set the content for a part using the encoding assigned to the handler. * @param part the part to assign. * @param buf the formatted data. * @param type the mime type or null, meaning text/plain. * @throws MessagingException if there is a problem. */ private void setContent(MimePart part, CharSequence buf, String type) throws MessagingException { final String charset = getEncodingName(); if (type != null && !"text/plain".equalsIgnoreCase(type)) { type = contentWithEncoding(type, charset); try { DataSource source = new ByteArrayDataSource(buf.toString(), type); part.setDataHandler(new DataHandler(source)); } catch (final IOException IOE) { reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE); part.setText(buf.toString(), charset); } } else { part.setText(buf.toString(), MimeUtility.mimeCharset(charset)); } }
bodyPart.setContent(body, type); } else { bodyPart.setText(body.toString());
bodyPart.setContent(body, type); } else { bodyPart.setText(body.toString());
((MimePart) primary).setText(msg, charset);