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: 12.2.0 build 630 for .NET 4.5
public DomainKeysVerifyResult DomainKeysVerify()

Return Value

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

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.

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(
            "", "", "secret", -1);

        // Display the result of DomainKeys/DKIM verification.
See Also