C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
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...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Saving Email Attachments Individually

Download: Chilkat .NET Assemblies

This example shows how to save email attachments individually.

// This example demonstrates how to save email attachments individually.
Chilkat.MailMan mailman = new Chilkat.MailMan();
mailman.UnlockComponent("30-day trial");

mailman.MailHost = "mail.chilkatsoft.com";
mailman.PopUsername = "***";
mailman.PopPassword = "***";

Chilkat.EmailBundle bundle = mailman.CopyMail();

int i;
int n = bundle.MessageCount;
for (i=0; i<n; i++)
{
	Chilkat.Email email = bundle.GetEmail(i);

	// Set OverwriteExisting = false if you do not want
	// SaveAttachedFile to overwrite existing files with the same
	// filename.  In that case, the filename is appended with
	// a few random characters to make it unique. You may then
	// get the actual filename saved by calling GetAttachmentFilename
	// after the SaveAttachedFile method call.
	email.OverwriteExisting = false;

	int numAttachments = email.NumAttachments;
	int j;

	for (j=0; j<numAttachments; j++)
	{
		string filenameBefore = email.GetAttachmentFilename(j);
		email.SaveAttachedFile(j,"c:/myAttachments");
		string filenameAfter = email.GetAttachmentFilename(j);		    
	}
}


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

 

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

Email Component · XML Parser