1 19 20 21 22 package org.apache.james.core; 23 24 import javax.mail.MessagingException ; 25 import javax.mail.Session ; 26 import javax.mail.internet.MimeMessage ; 27 28 import java.io.ByteArrayInputStream ; 29 import java.io.ByteArrayOutputStream ; 30 import java.io.IOException ; 31 import java.util.Properties ; 32 33 import junit.framework.TestCase; 34 35 public class MimeMessageUtilTest extends TestCase { 36 37 public void testWriteMimeMessageMultipartWithMessageID() throws MessagingException , IOException { 38 String message = "Received: from localhost.localdomain ([127.0.0.1])\r\n"+ 39 " by athlon14 (JAMES SMTP Server 2.3-dev) with SMTP ID 694\r\n"+ 40 " for <test_int1@athlon14.bf.loc>;\r\n"+ 41 " Sat, 18 Feb 2006 19:30:53 +0100 (CET)\r\n"+ 42 "Subject: ext2int\r\n"+ 43 "X-James-Postage: This is a test mail sent by James Postage\r\n"+ 44 "Mime-Version: 1.0\r\n"+ 45 "Content-Type: multipart/alternative; boundary=\"XyoYyxCQIfmZ5Sxofid6XQVZt5Z09XtTnqBF4Z45XSA=\"\r\n"+ 46 "Date: Sat, 18 Feb 2006 19:30:53 +0100 (CET)\r\n"+ 47 "From: test_ext2@another.bf.loc\r\n"+ 48 "\r\n"+ 49 "\r\n"+ 50 "--XyoYyxCQIfmZ5Sxofid6XQVZt5Z09XtTnqBF4Z45XSA=\r\n"+ 51 "Content-Type: text/plain\r\n"+ 52 "\r\n"+ 53 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"+ 54 "--XyoYyxCQIfmZ5Sxofid6XQVZt5Z09XtTnqBF4Z45XSA=\r\n"+ 55 "Content-Type: application/octet-stream\r\n"+ 56 "\r\n"+ 57 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"+ 58 "--XyoYyxCQIfmZ5Sxofid6XQVZt5Z09XtTnqBF4Z45XSA=--\r\n"; 59 60 ; 61 62 MimeMessage mimeMessage = new MimeMessage (Session.getDefaultInstance(new Properties ()),new ByteArrayInputStream (message.getBytes())); 63 mimeMessage.getSize(); 64 ByteArrayOutputStream headerOut = new ByteArrayOutputStream (); 65 ByteArrayOutputStream bodyOut = new ByteArrayOutputStream (); 66 MimeMessageUtil.writeTo(mimeMessage, headerOut, bodyOut); 67 } 68 69 } 70 | Popular Tags |