MailMessageDomainKeysVerify Method
Verifies DKIM and classic DomainKeys signatures of the current e-mail message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public DomainKeysVerifyResult DomainKeysVerify()

Return Value

Type: DomainKeysVerifyResult
The result of the verification.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

If the message contains only one signature (e.g. only DomainKeys or only DKIM), this method will still succeed (provided that this signature is valid).

If you need more advanced level of DomainKeys/DKIM verification (for instance, check multiple DKIM signatures in the same message), use DomainKeys class.

Note Note
If the current system is FIPS-compliant and runs .NET 2.0/3.5 and the message contains only DKIM signature created using SHA256 algorithm, the method will return Sha256NotSupported or throw an exception if ThrowExceptions is enabled. This can only occur with older .NET versions (before 4.0) because there was no FIPS-certified SHA256 implementation at that time. On a FIPS system, use MailBee.NET.dll for .NET 4.0+ to avoid these issues. See FipsMode and DomainKeysVerifyResult topics for details.

This method needs to make queries to a DNS server. For that, it executes Autodetect method. On some platforms like Xamarin autodetection may not work. You can manually populate DnsServers collection to workaround this.

Examples
This example displays the status of DomainKeys/DKIM signature of the last e-mail in the inbox.
using System;
using MailBee;
using MailBee.Mime;
using MailBee.Security;
using MailBee.Pop3Mail;

class Sample
{
    static void Main(string[] args)
    {
        // Download the last e-mail in inbox.
        MailMessage msg = Pop3.QuickDownloadMessage(
            "mail.company.com", "alex@company.com", "secret", -1);

        // Display the result of DomainKeys/DKIM verification.
        Console.WriteLine(msg.DomainKeysVerify().ToString());
    }
}
See Also