使用Go将电子邮件标头包含在应用程序引擎中吗?

The google app engine documentation doesn't describe how to include an email header, how do you do it, i.e. How do you change this?

    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)
    }

In the appengine/mail reference you can find that type Message has a field called Headers:

// Extra mail headers.
// See https://developers.google.com/appengine/docs/go/mail/overview
// for permissible headers.
Headers mail.Header

The type mail.Header can be found in the net/mail package, and only the following header names may be used, as described in the above overview link:

  • In-Reply-To
  • List-Id
  • List-Unsubscribe
  • On-Behalf-Of
  • References
  • Resent-Date
  • Resent-From
  • Resent-To

Example: (untested)

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"}},
}