Java Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Java Examples

Quick Start
Unicode
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
SFTP
Signatures
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
Upload
XML
XMP
Zip

More Examples...
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

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-2010 Chilkat Software, Inc. All Rights Reserved.