本文整理汇总了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()
}