From bf61fb7c186c54492ad8e65cd568d440947fba5c Mon Sep 17 00:00:00 2001 From: vinchent Date: Tue, 16 Jul 2024 13:35:10 +0200 Subject: [PATCH] sending mails using standard lib --- test_connect/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test_connect/main.go b/test_connect/main.go index f9d367a..a8115c1 100644 --- a/test_connect/main.go +++ b/test_connect/main.go @@ -4,6 +4,7 @@ import ( "database/sql" "fmt" "log" + "net/smtp" "os" _ "github.com/jackc/pgx/v5/stdlib" @@ -17,6 +18,11 @@ func main() { } defer conn.Close() + // Send test email + from := "me@here.com" + auth := smtp.PlainAuth("", from, "", "localhost") + _ = smtp.SendMail("localhost:1025", auth, from, []string{"you@there.com"}, []byte("Hello world")) + log.Println("Connected to database!") // test my connection