C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

Send Chinese Email

C# example code showing how to send email using gb2312 or big5.

	bool success = false;

	// Create a mailman object for sending email.
	Chilkat.MailMan mailman = new Chilkat.MailMan();

	// Any string argument automatically begins the 30-day trial.
	mailman.UnlockComponent("30-day trial");

	// Set the SMTP server.
	mailman.SmtpHost = "smtp.earthlink.net";

	// Create an email object
	Chilkat.Email email = new Chilkat.Email();

	// Set the basic email stuff: body, subject, "from", "to"
	// (This C# source code file was saved as Unicode.)
	email.Body = "香 港 剛 結 束 長 達 五 年 多";
	email.Subject = "香 港 剛 結 束 長 達 五 年 多";
	email.AddTo("五 年 多","support@chilkatsoft.com");
	email.From = "五 年 多 <programmer@chilkatsoft.com>";

	// Chilkat automatically recognizes that this email has Chinese characters,
	// and thus encodes everything as it is needed for the default Chinese encoding
	// of gb2312.
	// It is possible to verify this by examining the full MIME text of the email:
	MessageBox.Show(email.GetMime());

	// The MIME that Chilkat generates for this email looks like this:
	/*
	 * 
		MIME-Version: 1.0
		Date: Thu, 02 Sep 2004 15:38:17 -0500
		Message-ID: <CHILKAT-MID-aea4b5d4-7786-4124-8c78-6e6d743e63c3@DotNetDev>
		X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
		X-Priority: 3 (Normal)
		Content-Type: text/plain; charset="gb2312"
		Content-Transfer-Encoding: base64
		subject: =?gb2312?B?z+MguNsghIIgvVkgyvgg6Uwg?=
			=?gb2312?B?318gzuUgxOogtuA=?=
		To: =?gb2312?B?zuUgxOogtuA=?= <support@chilkatsoft.com>
		From: =?gb2312?B?zuUgxOogtuA=?= <programmer@chilkatsoft.com>
		return-path: programmer@chilkatsoft.com

		z+MguNsghIIgvVkgyvgg6Uwg318gzuUgxOogtuA=
	*/

	// We can easily change the encoding of this email to big5 by setting the Charset property:
	email.Charset = "big5";

	// Now look at the email MIME:
	MessageBox.Show(email.GetMime());

	/* GetMime() now returns this:
	 * 
		MIME-Version: 1.0
		Date: Thu, 02 Sep 2004 15:38:17 -0500
		Message-ID: <CHILKAT-MID-aea4b5d4-7786-4124-8c78-6e6d743e63c3@DotNetDev>
		X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
		X-Priority: 3 (Normal)
		Content-Transfer-Encoding: base64
		subject: =?big5?B?rbsgtOQgreggtbIgp/Qgqvgg?=
			=?big5?B?uUYgpK0gpn4gpmg=?=
		To: =?big5?B?pK0gpn4gpmg=?= <support@chilkatsoft.com>
		From: =?big5?B?pK0gpn4gpmg=?= <programmer@chilkatsoft.com>
		return-path: programmer@chilkatsoft.com
		Content-Type: text/plain; charset="big5"

		rbsgtOQgreggtbIgp/QgqvgguUYgpK0gpn4gpmg=
	*/

	success = mailman.SendEmail(email);
	if (success)
	{
		MessageBox.Show("Sent email!");
	}
	else
	{
		MessageBox.Show(mailman.LastErrorText);
	}

Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

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

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

Email Component · XML Parser