Fixed example
This commit is contained in:
parent
d1a35d0cce
commit
509ef2a315
|
@ -2,9 +2,11 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/google/uuid"
|
|
||||||
"net"
|
"net"
|
||||||
"smtp"
|
|
||||||
|
"net/textproto"
|
||||||
|
|
||||||
|
"git.ailur.dev/ailur/smtp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DatabaseBackend is a smtp.DatabaseBackend implementation that always returns true for CheckUser and prints the mail data to stdout.
|
// DatabaseBackend is a smtp.DatabaseBackend implementation that always returns true for CheckUser and prints the mail data to stdout.
|
||||||
|
@ -12,15 +14,15 @@ var DatabaseBackend = smtp.DatabaseBackend{
|
||||||
CheckUser: func(address *smtp.Address) (bool, error) {
|
CheckUser: func(address *smtp.Address) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
},
|
},
|
||||||
WriteMail: func(mail *smtp.Mail) (uuid.UUID, error) {
|
WriteMail: func(mail *smtp.Mail) error {
|
||||||
fmt.Println(string(mail.Data))
|
fmt.Println(string(mail.Data))
|
||||||
return uuid.New(), nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthenticationBackend is a smtp.AuthenticationBackend implementation that always returns a fixed address for Authenticate.
|
// AuthenticationBackend is a smtp.AuthenticationBackend implementation that always returns a fixed address for Authenticate.
|
||||||
var AuthenticationBackend = smtp.AuthenticationBackend{
|
var AuthenticationBackend = smtp.AuthenticationBackend{
|
||||||
Authenticate: func(authCommand string) (*smtp.Address, error) {
|
Authenticate: func(initial string, conn *textproto.Conn) (*smtp.Address, error) {
|
||||||
return &smtp.Address{
|
return &smtp.Address{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Address: "example.org",
|
Address: "example.org",
|
||||||
|
|
Loading…
Reference in New Issue