コード例 #1
0
ファイル: web.go プロジェクト: shreyaganguly/reddit-mailer
func InsertHandler(w http.ResponseWriter, r *http.Request) {
	var newSubscriber mail.Address
	newSubscriber.Name = r.FormValue("Name")
	newSubscriber.Address = r.FormValue("Email-id")
	if newSubscriber.Address == "" {
		fmt.Fprintf(w, "Sorry the email field cannot be left empty")
	} else if isPresent(newSubscriber.Address) == true {
		fmt.Fprintf(w, "Sorry the email address is already taken")
	} else {
		AddSubscriber(newSubscriber)
		fmt.Fprintf(w, "You have succesfully subscribed")
	}
}
コード例 #2
0
ファイル: engine.go プロジェクト: cathalgarvey/listless
func constructRFC5322(email, name string) string {
	m := new(mail.Address)
	m.Name = name
	m.Address = email
	return m.String()
}