From 6bc9832ede12362ef4dae061fd2f0248a2134afa Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Sat, 12 Mar 2022 15:42:40 +0100 Subject: [PATCH] More examples --- doc_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc_test.go b/doc_test.go index a127406..b53420d 100644 --- a/doc_test.go +++ b/doc_test.go @@ -6,6 +6,28 @@ import ( "os" ) +// Code example for the NewClient method +func ExampleNewClient() { + c, err := mail.NewClient("mail.example.com") + if err != nil { + panic(err) + } + _ = c + // Output: +} + +// Code example for the Client.SetTLSPolicy method +func ExampleClient_SetTLSPolicy() { + c, err := mail.NewClient("mail.example.com") + if err != nil { + panic(err) + } + c.SetTLSPolicy(mail.TLSMandatory) + fmt.Println(c.TLSPolicy()) + // Output: TLSMandatory +} + +// Code example for the Client.DialAndSend method func ExampleClient_DialAndSend() { from := "Toni Tester " to := "Alice "