package
1.2.0
Repository: https://github.com/mschneider82/go-smtp.git
Documentation: pkg.go.dev

# README

Usage

Client

package main

import (
	"log"
	"strings"

	"github.com/emersion/go-sasl"
	"github.com/mschneider82/go-smtp"
)

func main() {
	// Set up authentication information.
	auth := sasl.NewPlainClient("", "[email protected]", "password")

	// Connect to the server, authenticate, set the sender and recipient,
	// and send the email all in one step.
	to := []string{"[email protected]"}
	msg := strings.NewReader("To: [email protected]\r\n" +
		"Subject: discount Gophers!\r\n" +
		"\r\n" +
		"This is the email body.\r\n")
	err := smtp.SendMail("mail.example.com:25", auth, "[email protected]", to, msg)
	if err != nil {
		log.Fatal(err)
	}
}

If you need more control, you can use Client instead.