Open everyx opened 1 day ago
❯ tinygo run verifier.go # net/smtp /usr/lib/go/src/net/smtp/smtp.go:72:24: undefined: tls.Conn /usr/lib/go/src/net/smtp/smtp.go:172:25: undefined: tls.Conn
verifier.go
```go package main import ( "encoding/json" "fmt" emailVerifier "github.com/AfterShip/email-verifier" ) type Result struct { Data *emailVerifier.Result `json:"data"` Error error `json:"error"` } func (p Result) ToJson(result Result) (*string, error) { bytes, err := json.Marshal(result) if err != nil { fmt.Println("Error converting to JSON:", err) return nil, err } json := string(bytes) return &json, nil } //export add func verify(email string) string { var result Result verifier := emailVerifier.NewVerifier().EnableAutoUpdateDisposable() ret, err := verifier.Verify(email) if err != nil { result = Result{ Data: nil, Error: err, } } else { result = Result{ Data: ret, Error: nil, } } bytes, err := json.Marshal(result) if err != nil { fmt.Println("Error converting to JSON:", err) return fmt.Sprintf("{error:%s}", err.Error()) } return string(bytes) } func main() { fmt.Println(verify("test@example.com")) } ```