2022-03-05 16:27:09 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"github.com/wneessen/go-mail"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2022-03-07 18:14:38 +01:00
|
|
|
th := os.Getenv("TEST_HOST")
|
|
|
|
c, err := mail.NewClient(th, mail.WithTimeout(time.Millisecond*500))
|
2022-03-05 16:27:09 +01:00
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("failed to create new client: %s\n", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cfn := context.WithCancel(context.Background())
|
|
|
|
defer cfn()
|
|
|
|
|
|
|
|
if err := c.DialWithContext(ctx); err != nil {
|
|
|
|
fmt.Printf("failed to dial: %s\n", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
fmt.Printf("Client: %+v\n", c)
|
2022-03-07 16:24:49 +01:00
|
|
|
fmt.Printf("StartTLS policy: %s\n", c.TLSPolicy())
|
2022-03-05 16:27:09 +01:00
|
|
|
}
|