MailBee.NET Objects 7.2

MailMessage.IsEncrypted Property

Indicates if the message is encrypted.

public bool IsEncrypted {get;}

Property Value

true if the message is encrypted; otherwise, false.

Remarks

Messages can also be signed with a digital signature. To check if a message is signed or not, use IsSigned property.

To operate with IsEncrypted or IsSigned messages, use Smime object.

Example

This sample downloads a message from the POP3 server and reports whether this message is encrypted.

[C#]
using System;
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Download the first mail message from the specified POP3 account.
        MailMessage msg = Pop3.QuickDownloadMessage("pop3.mail.com", "kathy1981", "password", 1);

        // Display the subject of the message if it's not encrypted.
        if (msg.IsEncrypted)
        {
            Console.WriteLine("The subject can not be displayed because the message is encrypted.");
        }
        else
        {
            Console.WriteLine("The message has the following subject:\r\n" + msg.Subject);
        }
    }
}
[Visual Basic]
Imports System
Imports MailBee
Imports MailBee.Pop3Mail
Imports MailBee.Mime

Module Sample
    Sub Main(ByVal args As String())
        ' Download the first mail message from the specified POP3 account.
        Dim msg As MailMessage = Pop3.QuickDownloadMessage("pop3.mail.com", "kathy1981", "password", 1)

        ' Display the subject of the message if it's not encrypted.
        If msg.IsEncrypted Then
            Console.WriteLine("The subject can not be displayed because the message is encrypted.")
        Else
            Console.WriteLine("The message has the following subject:" & vbCrLf & msg.Subject)
        End If
    End Sub
End Module

See Also

MailMessage Class | MailBee.Mime Namespace | IsSigned