Modern email systems use a set of authentication mechanisms to help
verify that a message was sent from a legitimate source and not forged
by a spammer or attacker. The GetAuthenticationResults method
enables you to easily determine which of these mechanisms have passed
a check and which of them have failed. It evaluates the following
authentication information reported by the mail server:
SPF
Sender Policy Framework allows the owner of a domain to specify
which mail servers are authorized to send email on its behalf. If the
sending server is not listed in the domain's SPF record, the message
may be marked as suspicious. SPF helps prevent spoofing of the
envelope sender address, which is often used in phishing attacks.
DKIM
DomainKeys Identified Mail uses public-key cryptography to
sign specific parts of the email, such as headers and body content.
The signature is added by the sending mail server, and receiving
systems use DNS to retrieve the sender's public key to verify that
the message has not been tampered with. A valid DKIM signature
helps confirm that the message was truly sent by the claimed domain.
DMARC
Domain-based Message Authentication, Reporting, and Conformance
builds on SPF and DKIM by defining a policy for how a domain wants
email receivers to handle messages that fail authentication checks.
It also ensures that the visible From: address matches the domain
that passed SPF or DKIM (a concept called alignment). DMARC allows
domain owners to monitor abuse and enforce stronger protection against
spoofing.
Checking these authentication results can help identify spoofed or
forged messages, improve filtering decisions, and increase overall
mail security. While not every legitimate message will have all three,
failure of all mechanisms, especially from domains that publish strict
DMARC policies, should be treated as suspicious.
While these authentication methods are useful signals, failing one
of them does not necessarily mean a message is malicious. Many
legitimate messages, even from well-known companies, may have
misconfigured SPF records, missing DKIM signatures, or inconsistent
DMARC policies. Conversely, a message that passes all checks could
still be unwanted or deceptive. These results should be treated as
advisory signals rather than absolute indicators of legitimacy.
Developers are encouraged to consider authentication status alongside
other factors, such as message content, sender reputation, and user
reporting.
To simplify checking authentication outcomes, the following
predefined flag combinations are also available:
- MIME_AUTH_PASSED is a combination of all passing results (SPF, DKIM, DMARC).
- MIME_AUTH_FAILED is a combination of all failing results.
- MIME_AUTH_ERROR is a combination of temporary or permanent errors.
For a simplified boolean check using these flags, see the
CheckAuthenticationResults method.