Provides properties and methods for encrypting, decrypting, signing and verifying e-mail messages.
For a list of all members of this type, see Smime Members.
System.Object
MailBee.Security.Smime
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Using this class, you can perform the following operations with e-mail messages:
Note To use this class, make sure MailBee.NET Security Powerup is licensed (see LicenseKey property for details).
This sample retrieves the last e-mail from the specified POP3 account, decrypts it if it's encrypted and verifies its signature if any. Then, it prints the plain-text version of the message to the console.
[C#] // To use the code below, import these namespaces at the top of your code using System; using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; using MailBee.Security; Smime objSmime = new Smime(); Pop3 pop = new Pop3(); pop.Connect("server", 110, true); pop.Login("login", "password"); MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount); pop.Disconnect(); try { if (msg.IsEncrypted) { SmimeResult smResult = objSmime.DecryptAndVerify(msg, MessageVerificationFlags.All); if (smResult.VerificationResult > 0) { Console.WriteLine("Verification failed"); } else if (smResult.DecryptedMessage != null) { Console.WriteLine(smResult.DecryptedMessage.BodyPlainText); } } } catch (MailBeeException ex) { Console.WriteLine(ex.Message); }
[Visual Basic] ' To use the code below, import these namespaces at the top of your code. Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime Imports MailBee.Security Dim objSmime As Smime = New Smime Dim pop As Pop3 = New Pop3 pop.Connect("server", 110, True) pop.Login("login", "password") Dim msg As MailMessage = pop.DownloadEntireMessage(pop.InboxMessageCount) pop.Disconnect() Try If (msg.IsEncrypted) Then Dim smResult As SmimeResult = objSmime.DecryptAndVerify(msg, MessageVerificationFlags.All) If (smResult.VerificationResult > 0) Then Console.WriteLine("Verification failed") ElseIf (Not IsNothing(smResult.DecryptedMessage)) Then Console.WriteLine(smResult.DecryptedMessage.BodyPlainText) End If End If Catch ex As MailBeeException Console.WriteLine(ex.Message) End Try
Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll)
Smime Members | MailBee.Security Namespace