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 Digitally Signed Email in C#

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

How to add a digital signature to and email and send it in C#

This is a simple example demonstrating how to send a digitally signed mail via an SMTP server in C#.

private void SendSigned_Click(object sender, System.EventArgs e)
{
	// Create a mailman object for sending email.
	Chilkat.MailMan mailman = new Chilkat.MailMan();
	mailman.UnlockComponent("UnlockCode");

	mailman.SmtpHost = "smtp.earthlink.net";
	// The SMTP username and password are only necessary if
	// your SMTP server requires authentication.
	//mailman.SmtpUsername = "myLogin";
	//mailman.SmtpPassword = "myPassword";

	// Create an email object
	Chilkat.Email email = new Chilkat.Email();
	email.Subject = "This is the subject";
	email.Body = "This is the body";
	email.AddTo("Chilkat Support","support@chilkatsoft.com");
	email.From = "John Smith <jsmith@chilkatsoft.com>";

	// If a certificate matching the From email address exists in
	// the any of the following certificate stores, then Chilkat Mail
	// will automatically find it, select it, and sign the email with
	// it.
	//	1) Local Machine Certificate Store
	//  2) Current User Certificate Store
	//  3) Outlook Certificate Store
	// *** Note that the private key associated with the certificate
	// is accessed to sign the mail, and in some cases this causes
	// the Windows operating system to automatically pop up a dialog
	// warning that a private key access is about to take place.
	// For ways to avoid this warning, see http://www.chilkatsoft.com/privateKeyIssues.asp
	// For more information in general, see http://www.chilkatsoft.com/smime.asp
	email.SendSigned = true;

	// You can also specifically load a certificate from a file in
	// any one of the following formats:
	// 1) DER encoded binary X.509 (.CER)
	// 2) Base-64 encoded X.509 (.CER)
	// 3) Cryptographic Message Syntax Standard - PKCS #7 Certificates (.P7B)
	Chilkat.Cert cert = new Chilkat.Cert();
	cert.LoadFromFile("myCert.cer");
	email.SetSigningCert(cert);

	Status.Text = "Sending email...";
	Status.Refresh();
	bool success = mailman.SendEmail(email);
	if (!success) 
	{
		Status.Text = "Send Failed, check sendError.xml";
		mailman.SaveLastError("sendError.xml");
	}
	else
	{
		Status.Text = "Success!";
	}
}


 

 

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

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

Email Component · XML Parser