Go library for Email, Notification, SMS
$ go get github.com/smartblock/[email protected]
package main
import (
"fmt"
"github.com/smartblock/pkgscens"
)
func main() {
smtpAuth := pkgscens.SMTPAuth{
Identity: "",
Username: "[email protected]",
Password: "your_password",
Host: "smtp.gmail.com",
}
sendMailInput := pkgscens.SendMailInput{
Addr: "smtp.gmail.com:587",
SMTPAuth: smtpAuth,
FromName: "Noreply Example",
FromMail: "[email protected]",
ToMail: []string{"[email protected]"},
ToName: []string{"ReceipientName"},
Subject: "First Test Email",
//HTML or TEXT
MsgType: "HTML",
Message: "<h1>My First Message</h1>",
}
err := pkgscens.SendMail(sendMailInput)
if err != nil {
//Error Return
fmt.Println(err)
}
//Send Success
fmt.Println("send success")
}