Java Code Examples for javax.mail.internet.MimeMessage#getDataHandler()

The following examples show how to use javax.mail.internet.MimeMessage#getDataHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmailServiceTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 2
Source File: EmailSendTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 3
Source File: EmailServiceTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 4
Source File: EmailSendTaskTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 5
Source File: EmailServiceTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
}
 
Example 6
Source File: EmailSendTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
}
 
Example 7
Source File: CmmnMailTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) {
    try {
        DataHandler dataHandler = mimeMessage.getDataHandler();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        dataHandler.writeTo(baos);
        baos.flush();
        return baos.toString();
    } catch (Exception e) {
        throw new RuntimeException("Couldn't get message", e);
    }
}
 
Example 8
Source File: EmailServiceTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
}
 
Example 9
Source File: EmailSendTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
}
 
Example 10
Source File: EmailServiceTaskTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 11
Source File: EmailSendTaskTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
  DataHandler dataHandler = mimeMessage.getDataHandler();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  dataHandler.writeTo(baos);
  baos.flush();
  return baos.toString();
}
 
Example 12
Source File: AbstractEmailTest.java    From commons-email with Apache License 2.0 3 votes vote down vote up
/**
 * Gets the byte making up the body of the message.
 *
 * @param mimeMessage
 *            The mime message from which to extract the body.
 * @return A byte array representing the message body
 * @throws IOException
 *             Thrown while serializing the body from
 *             {@link DataHandler#writeTo(java.io.OutputStream)}.
 * @throws MessagingException
 *             Thrown while getting the body content from
 *             {@link MimeMessage#getDataHandler()}
 * @since 1.1
 */
private byte[] getMessageBodyBytes(final MimeMessage mimeMessage)
        throws IOException, MessagingException
{
    final DataHandler dataHandler = mimeMessage.getDataHandler();
    final ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
    final BufferedOutputStream buffOs = new BufferedOutputStream(
            byteArrayOutStream);
    dataHandler.writeTo(buffOs);
    buffOs.flush();

    return byteArrayOutStream.toByteArray();
}