谷歌应用引擎文档没有描述如何包含电子邮件标题,你是如何做到的,即你如何改变它?
msg := &mail.Message{
Sender: "Example.com Support <support@example.com>",
To: []string{"email@bob.com"},
Subject: "Confirm your registration",
Body: fmt.Sprintf(confirmMessage, url),
}
if err := mail.Send(c, msg); err != nil {
c.Errorf("Couldn't send email: %v", err)
}
答案 0 :(得分:1)
在 appengine/mail
reference 中,您可以发现类型的消息有一个名为Headers
的字段:
// Extra mail headers.
// See https://developers.google.com/appengine/docs/go/mail/overview
// for permissible headers.
Headers mail.Header
可以在 net/mail
包中找到mail.Header
类型,并且只能使用以下标题名称,如above overview link中所述:< / p>
示例:(未经测试)
import netmail "net/mail" // mail is already taken by appengine/mail
...
msg := &mail.Message{
Sender: "Example.com Support <support@example.com>",
To: []string{"email@bob.com"},
Subject: "Confirm your registration",
Body: fmt.Sprintf(confirmMessage, url),
Headers: netmail.Header{"In-Reply-To": []string{"123456789"}},
}