Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Encrypted Email using a Specific Certificate
This example discusses sending encrypted email using a digital certificate that does not match the recipient's email address. Chilkat.MailMan mailman = new Chilkat.MailMan(); mailman.UnlockComponent("anything for 30-day trial"); mailman.SmtpHost = "smtp.comcast.net"; Chilkat.Email email = new Chilkat.Email(); email.Subject = "Test encrypted mail"; email.Body = "Test encrypted mail..."; email.From = "support@chilkatsoft.com"; email.AddTo("Matt","matt@chilkatsoft.com"); // Indicate that we want the email to be sent encrypted by setting // the SendEncrypted property = true. // Normally, this is all that needs to be done because when SendEmail // is called, Chilkat will locate the certificate matching the // recipient's email address and use it for encrypting. email.SendEncrypted = true; // In this case however, we will explicitly set the encryption // certificate to one that DOES NOT MATCH the recipient's email address. // If the email is to be received and read using an email client // such as Outlook or Mozilla Thunderbird, this may not be OK. When sending // encrypted email that is to be read using these email clients, the // encrypting certificate usually matches the recipient's email address. // Otherwise the recipient may not be able to decrypt and read the email. // For the purpose of this example, Chilkat has tested with both // Outlook Express and Mozilla Thunderbird and found that IF the certificate // WITH PRIVATE KEY is properly installed (from a .pfx), both email clients are able // to decrypt and display the message. // NOTE: You only need the public-key to encrypt an email, but you need // the private key to decrypt. Thus, if you intend to encrypt your email // using your web server's SSL certificate, you would need to provide the // private key of your SSL certificate to all potential recipients. I hardly // think that this is something you would want to do... // Chilkat provides the ability to explicitly set a certificate for encrypting: Chilkat.Cert cert = new Chilkat.Cert(); cert.LoadFromFile("tagtooga.cer"); email.SetEncryptCert(cert); // Encrypt and send the email using our chosen digital certificate. bool success = mailman.SendEmail(email); MessageBox.Show(mailman.LastErrorText); Important: The download for this
example does not contain the ChilkatDotNet.dll which |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.