sending mails using standard lib
This commit is contained in:
		@ -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
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user