Skip to content

danielsen/NetSPF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetSPF

NetSPF is a SPF verification utility for .NET.

Packages

  • Current Version: 1.2.0
  • Target Framework: .NET Standard 2.0

Dependencies

Usage

In keeping with convention the SpfResolver class provides a function called CheckHost as an entry point to verification. CheckHost takes the following parameters:

  • IPAddress, (IPv4 or IPv6) the IP emitting the mail.
  • domainName, the domain label from MAIL FROM or HELO.
  • sender, the MAIL FROM or HELO identity, e.g. [email protected].
  • heloDomain, the domain label presented by the client in HELO or EHLO.
  • hostDomain, the domain of the current host performinng authentication.
  • dnsHost (optional), specific DNS host to query.
  • SpfExpression Array, (optional) SPF expressions to use if the domain doesn't provide records in DNS.

For example:

var ipAddress = IPAddress.Parse("11.22.33.44");
var result = SpfResolver.CheckHost(ipAddress, "zz.com", "[email protected]", "zz.com", "aa.com");

// Using a specific DNS host.
var dnsHost = IPAddress.Parse("1.1.1."); // Clodflare DNS
var ipAddress = IPAddress.Parse("11.22.33.44");
var result = SpfResolver.CheckHost(ipAddress, "zz.com", "[email protected]", "zz.com", "aa.com", dnsHost);

CheckHost returns a KeyValuePair<SpfResult, string> where string is an explanation if any or simply the string representation of the SpfResult

Packages

No packages published

Languages