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
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

Java to Send Korean Email

Download Chilkat Java Library

Java program to send Korean email.

// Java program to send Korean email
	
// This source file contains Korean characters and is therefore
// saved using the utf-8 encoding.

// When you compile this program with the command javac ***.java, 
// the compiler does not know the encoding of the source file and uses your
// computer's default encoding. You must tell javac which encoding to 
// use explicitly. Use the -encoding option to do this: 
// javac -encoding utf8 ***.java .
	
// Also, do not emit the 3-byte BOM (byte order mark) signature at the 
// beginning of the file.  The BOM bytes will cause  javac compiler to fail.
// Files containing the 3-byte utf-8 BOM will begin with 0xEF 0xBB 0xBF
	
	
import com.chilkatsoft.CkMailMan;
import com.chilkatsoft.CkEmail;

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

  // Simple example showing how to send Korean mail in Java
  public static void main(String argv[]) 
  {
    CkMailMan mailman = new CkMailMan();
    mailman.UnlockComponent("anything for 30-day trial");
    
    // Set your SMTP server's hostname
    mailman.put_SmtpHost("smtp.comcast.net");
    
    // If your SMTP server requires a login, set username/password
    //mailman.put_SmtpUsername("myUsername");
    //mailman.put_SmtpPassword("myPassword");
    
    // Create a simple email using Korean characters in subject, body, ...
    CkEmail email = new CkEmail();
    email.put_Subject("나는 유리를 먹을 수 있어요");
    email.put_Body("나는 유리를 먹을 수 있어요. 그래도 아프지 않아요");
    email.put_From("유리를 <support@chilkatsoft.com>");
    // Add a few recipients
    email.AddTo("있어요","matt@chilkatsoft.com");
    email.AddTo("아프지","admin@tagtooga.com");
    
    // Chilkat automatically recognizes the Korean characters and chooses
    // a typical charset for Korean email: ks_c_5601-1987.
    // Had the email contained characters not representable in ks_c_5601-1987 (such as Hebrew 
    // characters) the component would have automatically chosen utf-8 as the encoding.

    // The charset used throughout the entire email can be explicitly changed by setting
    // the Charset property:
    // email.put_Charset("utf-8");

	// Send the email...
    boolean success = mailman.SendEmail(email);
    if (!success)
    {
    	mailman.SaveLastError("lastError.txt");	
    }
    
  }
}

 

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

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