DummySpamMail.java :  » Web-Server » xsocket » org » xsocket » mail » Java Open Source

Java Open Source » Web Server » xsocket 
xsocket » org » xsocket » mail » DummySpamMail.java
package org.xsocket.mail;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;



public final class DummySpamMail {
  
  private static String testMail = 
      "Received: from localhost (localhost [127.0.0.1])\r\n" 
    + "by Semta.de with ESMTP id 881588961.1153334034540.1900236652.1\r\n" 
    + "for feki@semta.de; Mi, 19 Jul 2006 20:34:00 +0200\r\n" 
    + "Message-ID: <24807938.01153334039898.JavaMail.grro@127.0.0.1>\r\n" 
    + "Date: Wed, 19 Jul 2006 20:33:59 +0200 (CEST)\r\n" 
    + "From: feki2 <fekete99@web.de>\r\n" 
    + "To: Gregor Roth <feki@semta.de>\r\n" 
    + "Subject: Test mail\r\n" 
    + "MIME-Version: 1.0\r\n" 
    + "Content-Type: multipart/mixed;\r\n" 
    + "boundary=\"----=_Part_1_14867177.1153334039707\"\r\n" 
    + "\r\n" 
    + "This is a multi-part message in MIME format.\r\n"
    + "------=_Part_1_14867177.1153334039707\r\n" 
    + "Content-Type: multipart/mixed;\r\n" 
    + "boundary=\"----=_Part_0_14158819.1153334039687\"\r\n" 
    + "\r\n" 
    + "------=_Part_0_14158819.1153334039687\r\n" 
    + "Content-Type: text/plain; charset=us-ascii\r\n" 
    + "Content-Transfer-Encoding: 7bit\r\n" 
    + "\r\n" 
    + "Halli Hallo THIS IS SPAM   wreewrwr\r\n" 
    + "------=_Part_0_14158819.1153334039687\r\n" 
    + "------=_Part_1_14867177.1153334039707--";


  public ByteBuffer getAsByteBuffer() {
    try {
      Charset charset = Charset.forName("ISO-8859-1");
        CharsetEncoder encoder = charset.newEncoder();
        ByteBuffer buf = encoder.encode(CharBuffer.wrap(testMail.toCharArray()));
        return buf;
    } catch (Exception e) {
      throw new RuntimeException(e.toString());
    }
  }


}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.