https://github.com/asggo/spf
Parse SPF record and determine if client IP is allowed to send email.
https://github.com/asggo/spf
dns go golang security sender-policy-framework spf spf-record
Last synced: 4 months ago
JSON representation
Parse SPF record and determine if client IP is allowed to send email.
- Host: GitHub
- URL: https://github.com/asggo/spf
- Owner: asggo
- License: other
- Created: 2017-10-20T16:46:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T15:43:46.000Z (about 5 years ago)
- Last Synced: 2024-06-19T00:24:34.043Z (almost 2 years ago)
- Topics: dns, go, golang, security, sender-policy-framework, spf, spf-record
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 29
- Watchers: 2
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Package spf
[](http://godoc.org/github.com/asggo/spf)
Package spf parses an SPF record and determines if a given IP address
is allowed to send email based on that record. SPF handles all of the
mechanisms defined at http://www.open-spf.org/SPF_Record_Syntax/.
## Example
```Go
package main
import "github.com/asggo/spf"
func main() {
SMTPClientIP := "1.1.1.1"
envelopeFrom := "info@example.com"
result, err := spf.SPFTest(SMTPClientIP, envelopeFrom)
if err != nil {
panic(err)
}
switch result {
case spf.Pass:
// allow action
case spf.Fail:
// deny action
}
//...
}
```