package main import ( "log" "net/mail" "net/smtp" "strconv" "qoobing.com/gomod/email" ) func main() { fromAddr := "ubbeybox@yqtc.com" fromPass := "yqtc@018ubox" fromSmtpAddr := "smtp.gmail.com" fromSmtpPort := 587 //465;//587 toAddr := "q.bryant@live.com" // compose the message m := email.NewMessage("Hi", "this is the body") m.From = mail.Address{Name: "From", Address: fromAddr} m.To = []string{toAddr} // add attachments if err := m.Attach("email.go"); err != nil { log.Fatal(err) } // send it auth := smtp.PlainAuth("", fromAddr, fromPass, fromSmtpAddr) if err := email.Send(fromSmtpAddr+":"+strconv.Itoa(fromSmtpPort), auth, m); err != nil { log.Fatal(err) } else { log.Println("done") } }