Fixed example code

This commit is contained in:
Winni Neessen 2022-03-12 15:35:20 +01:00
parent 81cf2e646c
commit c41301e26b
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -1,7 +1,8 @@
package mail package mail_test
import ( import (
"fmt" "fmt"
"github.com/wneessen/go-mail"
"os" "os"
) )
@ -10,7 +11,7 @@ func ExampleClient_DialAndSend() {
to := "Alice <alice@example.com>" to := "Alice <alice@example.com>"
server := "mail.example.com" server := "mail.example.com"
m := NewMsg() m := mail.NewMsg()
if err := m.From(from); err != nil { if err := m.From(from); err != nil {
fmt.Printf("failed to set FROM address: %s", err) fmt.Printf("failed to set FROM address: %s", err)
os.Exit(1) os.Exit(1)
@ -21,7 +22,7 @@ func ExampleClient_DialAndSend() {
} }
m.Subject("This is a great subject") m.Subject("This is a great subject")
c, err := NewClient(server) c, err := mail.NewClient(server)
if err != nil { if err != nil {
fmt.Printf("failed to create mail client: %s", err) fmt.Printf("failed to create mail client: %s", err)
os.Exit(1) os.Exit(1)