1. 使用したライブラリ
email : https://github.com/jordan-wright/email「go get github.com/jordan-wright/email」でインストール可能
2. 基本的な使い方
package main
import (
    "net/smtp"
    "github.com/jordan-wright/email"
)
func main() {
    e := email.NewEmail()                                                                            // メール作成
    e.From = "test@gmail.com"                                                                        // 送信元
    e.To = []string{"test@example.com"}                                                              // 送信先
    e.Bcc = []string{"bcc@example.com"}                                                              // Bcc
    e.Cc = []string{"cc@example.com"}                                                                // Cc
    e.Subject = "Test Subject"                                                                       // タイトル
    e.Text = []byte("Test text")                                                                     // 本文
    e.HTML = []byte("<h1>No means</h1>")                                                             // 本文 (HTML)
    e.Send("smtp.gmail.com:587", smtp.PlainAuth("", "test@gmail.com", "password", "smtp.gmail.com")) // メール送信
}
二段階認証を導入している場合はアプリパスワードを設定
アプリパスワードの発行
3. 使用例
送信元などを標準入力から取得できるように改良してみましたpackage main
import (
    "bufio"
    "fmt"
    "net/smtp"
    "os"
    "github.com/jordan-wright/email"
)
func main() {
    e := email.NewEmail()
    stdin := bufio.NewScanner(os.Stdin)
    fmt.Print("From : ")
    stdin.Scan()
    From := stdin.Text()
    fmt.Print("From password : ")
    stdin.Scan()
    password := stdin.Text()
    fmt.Print("To : ")
    stdin.Scan()
    To := stdin.Text()
    Bcc := ""
    fmt.Print("Bcc (if no BCC -> \"no\") : ")
    stdin.Scan()
    if stdin.Text() != "no" {
        Bcc = stdin.Text()
    }
    Cc := ""
    fmt.Print("Cc (if no Cc -> \"no\") : ")
    stdin.Scan()
    if stdin.Text() != "no" {
        Cc = stdin.Text()
    }
    Subject := ""
    fmt.Print("Subject (if no Subject -> \"no\") : ")
    stdin.Scan()
    if stdin.Text() != "no" {
        Subject = stdin.Text()
    }
    Text := ""
    fmt.Print("Text (if no Text -> \"no\") : ")
    stdin.Scan()
    if stdin.Text() != "no" {
        Text = stdin.Text()
    }
    HTML := ""
    fmt.Print("HTML (if no HTML -> \"no\") : ")
    stdin.Scan()
    if stdin.Text() != "no" {
        HTML = stdin.Text()
    }
    e.From = From
    e.To = []string{To}
    if Bcc != "" {
        e.Bcc = []string{Bcc}
    }
    if Cc != "" {
        e.Cc = []string{Cc}
    }
    if Subject != "" {
        e.Subject = Subject
    }
    if Text != "" {
        e.Text = []byte(Text)
    }
    if HTML != "" {
        e.HTML = []byte(HTML)
    }
    e.Send("smtp.gmail.com:587", smtp.PlainAuth("", From, password, "smtp.gmail.com"))
}4. 参考
https://github.com/jordan-wright/email(ライブラリ)http://increment.hatenablog.com/entry/2017/06/04/210531(アプリパスワードに関して)