Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m := email.NewMessage("Hi", "this is the body")
- m.From = mail.Address{Name: "From", Address: "ex@gmail.com"}
- m.To = []string{"exxx@gmail.com"}
- // add attachments
- if err := m.Attach("pictures.png"); err != nil {
- log.Fatal(err)
- }
- // send it
- auth := smtp.PlainAuth("", "ex@gmail.com", "Mob2221", "smtp.gmail.com")
- if err := email.Send("smtp.gmail.com:587", auth, m); err != nil {
- log.Fatal(err)
- }
Add Comment
Please, Sign In to add comment