emersion / go-msgauth

🔏 A Go library and tools for DKIM, DMARC and Authentication-Results
MIT License
168 stars 52 forks source link

How to use your library? #1

Closed worddevfr closed 6 years ago

worddevfr commented 6 years ago

Hi, How to use your library? Can you give us a concrete example with the domain gmail.com?

NB: It is not issue

emersion commented 6 years ago

Read the README. Read the docs.

emersion commented 6 years ago

Oh, and read the RFC too.

worddevfr commented 6 years ago

read me is empty and no doc. It's nothing, I'm going to look for another bookstore. Good continuation

emersion commented 6 years ago

Oh, sorry. I though this issue was for go-imap.

Then read the docs: https://godoc.org/github.com/emersion/go-msgauth

I should add an example to README. Will do tomorrow.

emersion commented 6 years ago

Updated README with an example usage.

worddevfr commented 6 years ago

go build

spf

.\main.go:12:29: undefined: ResultPass .\main.go:13:30: undefined: ResultPass

in main.go

package main

import ( "github.com/emersion/go-msgauth" "log" )

func main() {

// Format
results := []msgauth.Result{
    &msgauth.SPFResult{Value: ResultPass, From: "example.net"},
    &msgauth.AuthResult{Value: ResultPass, Auth: "sender@example.com"},
}

s := msgauth.Format("example.com", results)
log.Println(s)

// Parse
identifier, results, err := msgauth.Parse(s)
if err != nil {
    log.Fatal(err)
}

log.Println(identifier, results)

}

emersion commented 6 years ago

Fixed.