Search in sources :

Example 1 with CRLFOutputStream

use of com.sun.mail.util.CRLFOutputStream in project nhin-d by DirectProject.

the class DefaultSmtpAgent method canonicalizeMessage.

/**
	 * Create a canonicalized version of a given mime message
	 * 
	 * @param mimeMessage
	 *            the message to canonicalize
	 * @return a mime message in the canonical form
	 * @throws IOException
	 * @throws MessagingException
	 */
protected MimeMessage canonicalizeMessage(MimeMessage mimeMessage) throws IOException, MessagingException {
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    CRLFOutputStream crlfOutputStream = new CRLFOutputStream(byteArrayOutputStream);
    mimeMessage.writeTo(crlfOutputStream);
    return new MimeMessage((Session) null, new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
}
Also used : MimeMessage(javax.mail.internet.MimeMessage) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CRLFOutputStream(com.sun.mail.util.CRLFOutputStream)

Aggregations

CRLFOutputStream (com.sun.mail.util.CRLFOutputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 MimeMessage (javax.mail.internet.MimeMessage)1