예제 #1
0
func clearHandler(responseWriter http.ResponseWriter, request *http.Request) {
	request.ParseForm()
	token := request.Form.Get("token")

	if validToken(token) && request.Method == "POST" {
		notable.Reset()
	}
}
예제 #2
0
파일: main.go 프로젝트: harvesthq/notable
func main() {
	if port, err := strconv.Atoi(os.Getenv("SMTP_PORT")); err == nil {
		if len(notable.Notes()) > 0 {
			notable.SendEmail(
				os.Getenv("SMTP_HOST"),
				port,
				os.Getenv("SMTP_USERNAME"),
				os.Getenv("SMTP_PASSWORD"),
				os.Getenv("FROM_EMAIL"),
				os.Getenv("FROM_NAME"),
				os.Getenv("TO_EMAIL"),
				os.Getenv("TO_NAME"),
			)
			if os.Getenv("NO_RESET") == "" {
				notable.Reset()
			} else {
				log.Print("Not resetting notes")
			}
		}
	} else {
		log.Fatal(err)
	}
}
예제 #3
0
func main() {
	if len(notable.Notes()) > 0 {
		notable.SendEmail(os.Getenv("MANDRILL_API_KEY"))
		notable.Reset()
	}
}