本文整理匯總了Golang中net/mail.Address.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Address.Name方法的具體用法?Golang Address.Name怎麽用?Golang Address.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net/mail.Address
的用法示例。
在下文中一共展示了Address.Name方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: InsertHandler
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: constructRFC5322
func constructRFC5322(email, name string) string {
m := new(mail.Address)
m.Name = name
m.Address = email
return m.String()
}