assertEquals("Example <from@example.com>", email.getFrom().toString());
assertEquals("to@example.com", email.getTo()[0].toString());
assertEquals("test!", email.getSubject());
// the time is specified in GMT zone
JDateTime jdt = new JDateTime(2010, 3, 27, 12, 11, 21, 0);
jdt.changeTimeZone(TimeZone.getTimeZone("GMT"), TimeZone.getDefault());
// compare
assertEquals(jdt.convertToDate(), email.getSentDate());
Map<String, String> headers = email.getAllHeaders();
assertEquals("1.0", headers.get("MIME-Version"));
List<EmailMessage> messages = email.getAllMessages();
assertEquals(2, messages.size());
EmailMessage msg1 = messages.get(0);
assertEquals("Test", msg1.getContent().trim());
assertEquals("text/plain", msg1.getMimeType());
assertEquals("us-ascii", msg1.getEncoding());
EmailMessage msg2 = messages.get(1);
assertTrue(msg2.getContent().contains("Test<o:p>"));
assertEquals("text/html", msg2.getMimeType());
assertEquals("us-ascii", msg2.getEncoding());
List<EmailAttachment> attachments = email.getAttachments();
assertNull(attachments);
List<ReceivedEmail> attachedMessages = email.getAttachedMessages();
assertNotNull(attachedMessages);
assertEquals(1, attachedMessages.size());
email = attachedMessages.get(0);
// attached message
assertEquals("Example <from@example.com>", email.getFrom().toString());
assertEquals("to@example.com", email.getTo()[0].toString());
assertEquals("test", email.getSubject());
jdt = new JDateTime(2010, 3, 27, 12, 9, 46, 0);
jdt.changeTimeZone(TimeZone.getTimeZone("GMT"), TimeZone.getDefault());
assertEquals(jdt.convertToDate(), email.getSentDate());
headers = email.getAllHeaders();
assertEquals("1.0", headers.get("MIME-Version"));
messages = email.getAllMessages();