Skip to content

Instantly share code, notes, and snippets.

@napsy
Created October 1, 2012 07:49
Show Gist options
  • Save napsy/3810170 to your computer and use it in GitHub Desktop.
Save napsy/3810170 to your computer and use it in GitHub Desktop.
str := "From: mail notification service <" + GlobalConfig.MailAddress + ">\nTo: Owner <" + repository.NotifyEmail + ">\nSubject: [" + repository.Name + "] error notification\n\nSomething went wrong while handling the repository '" + repository.Name + "'. Please check the output log files!\n"
auth := smtp.PlainAuth(GlobalConfig.MailUsername, GlobalConfig.MailUsername, GlobalConfig.MailPassword, GlobalConfig.MailHost)
err := smtp.SendMail(GlobalConfig.MailHost + ":25", auth, GlobalConfig.MailAddress, []string{repository.NotifyEmail}, []byte(str))
if err != nil {
fmt.Printf("Error sending mail: %s\n", err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment