MailMessageDomainKeysVerify Method |
Namespace: MailBee.Mime
Exception | Condition |
---|---|
MailBeeException | An 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 |
---|
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.
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()); } }