MIG is a Go library that enables you to send emails using various mail providers, including SMTP. It aims to make sending emails easy and intuitive, with a clean API and clear documentation.
To install Mig, use go get
:
go get github.com/shahariaazam/mig
The library is very easy to use. Here's an example that shows how to send an email using SMTP:
package main
import (
"github.com/shahariaazam/mig/pkg/engine"
"github.com/shahariaazam/mig/pkg/message"
"net/mail"
)
func main() {
// Create a new SMTP client
smtpClient := engine.NewSMTP("username", "password", "smtp.example.com", "587")
// Create a test message
msg := message.Message{
From: mail.Address{
Name: "Jane Smith",
Address: "janesmith@example.com",
},
To: []mail.Address{
{
Name: "Jane Smith",
Address: "janesmith@example.com",
},
},
Subject: "Test Email",
Text: "This is a test email",
}
// Send the email
err := smtpClient.Send(msg)
if err != nil {
panic(err)
}
}
Contributions are welcome. If you encounter any issues or have any feature requests, please create an issue on GitHub.
MIG is released under the MIT license.