Java Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Java Examples

Quick Start
Java Unicode
Java Certs
Java Email
Java Encryption
Java FTP
HTML-to-XML
Java HTTP
Java IMAP
Java MHT
Java MIME
Java RSA
Java S/MIME
Java Signatures
Java Socket
Java Spider
Java Tar
Java Upload
Java XML
Java XMP
Java Zip

More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Access Attached Message (Embedded Email)

How to access an email embedded within another email (i.e. an attached message).

Download Chilkat Java Library

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    CkEmail email = new CkEmail();

    //  Load an email from a .eml
    boolean success;
    success = email.LoadEml("embeddedEmail.eml");
    if (success != true) {
        System.out.println(email.lastErrorText());
        return;
    }

    //  Display how many attached emails are embedded within
    //  this one:
    int numAttached;
    numAttached = (int) email.get_NumAttachedMessages();
    System.out.println(numAttached);

    //  Get the 1st attached message.
    CkEmail email2;
    email2 = email.GetAttachedMessage(0);
    if (!(email2 == null )) {

        //  Display the subject, From, and a header field...
        System.out.println(email2.subject());
        System.out.println(email2.ck_from());
        System.out.println(email2.getHeaderField("X-SOMETHING"));
    }


  }
}

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.