Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.js

C# Examples

Async
Certificates
ECC
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
JSON
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
REST
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Stream
Tar Archive
XML
XMP
Zip

More Examples...
Google APIs
Google Cloud Storage
Azure Cloud Storage
Amazon S3 (new)
Google Drive
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
NTLM
QuickBooks

 

 

 

 

 

 

 

Send Digitally Signed Email in C#

Download: Chilkat .NET Assemblies

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!";
	}
}


 

 

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