Skip to content

Instantly share code, notes, and snippets.

@mikespook
Created November 12, 2014 06:20
Show Gist options
  • Save mikespook/8ec5735344dc561e7428 to your computer and use it in GitHub Desktop.
Save mikespook/8ec5735344dc561e7428 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/mikespook/golib/log"
"gopkg.in/gomail.v1"
)
func main() {
addr := "mail.awecent.com"
port := 25
user := "noreply@awecent.com"
password := "noreply12#$"
msg := gomail.NewMessage()
msg.SetHeader("From", user)
msg.SetHeader("To", "xingx@millionhero.com")
msg.SetHeader("Subject", "Hello world")
msg.SetBody("text/html", "Hello world")
mailer := gomail.NewMailer(addr, user, password, port)
if err := mailer.Send(msg); err != nil {
log.Error(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment