01: package org.xsocket.mail;
02:
03: import java.nio.ByteBuffer;
04: import java.nio.CharBuffer;
05: import java.nio.charset.Charset;
06: import java.nio.charset.CharsetEncoder;
07:
08: public final class DummySpamMail {
09:
10: private static String testMail = "Received: from localhost (localhost [127.0.0.1])\r\n"
11: + "by Semta.de with ESMTP id 881588961.1153334034540.1900236652.1\r\n"
12: + "for feki@semta.de; Mi, 19 Jul 2006 20:34:00 +0200\r\n"
13: + "Message-ID: <24807938.01153334039898.JavaMail.grro@127.0.0.1>\r\n"
14: + "Date: Wed, 19 Jul 2006 20:33:59 +0200 (CEST)\r\n"
15: + "From: feki2 <fekete99@web.de>\r\n"
16: + "To: Gregor Roth <feki@semta.de>\r\n"
17: + "Subject: Test mail\r\n"
18: + "MIME-Version: 1.0\r\n"
19: + "Content-Type: multipart/mixed;\r\n"
20: + "boundary=\"----=_Part_1_14867177.1153334039707\"\r\n"
21: + "\r\n"
22: + "This is a multi-part message in MIME format.\r\n"
23: + "------=_Part_1_14867177.1153334039707\r\n"
24: + "Content-Type: multipart/mixed;\r\n"
25: + "boundary=\"----=_Part_0_14158819.1153334039687\"\r\n"
26: + "\r\n"
27: + "------=_Part_0_14158819.1153334039687\r\n"
28: + "Content-Type: text/plain; charset=us-ascii\r\n"
29: + "Content-Transfer-Encoding: 7bit\r\n"
30: + "\r\n"
31: + "Halli Hallo THIS IS SPAM wreewrwr\r\n"
32: + "------=_Part_0_14158819.1153334039687\r\n"
33: + "------=_Part_1_14867177.1153334039707--";
34:
35: public ByteBuffer getAsByteBuffer() {
36: try {
37: Charset charset = Charset.forName("ISO-8859-1");
38: CharsetEncoder encoder = charset.newEncoder();
39: ByteBuffer buf = encoder.encode(CharBuffer.wrap(testMail
40: .toCharArray()));
41: return buf;
42: } catch (Exception e) {
43: throw new RuntimeException(e.toString());
44: }
45: }
46:
47: }
|