I'm trying to send an email using the gmail API in golang as follows:
var message gmail.Message
from := `"CUSTOM NAME" abc@gmail.com`
header := make(map[string]string)
header["From"] = from
header["To"] = "to@email.com"
header["Reply-to"] = from
header["Subject"] = "subject"
header["Content-Type"] = "text/html; charset=\"utf-8\""
msg := ""
for k, v := range header {
msg += fmt.Sprintf("%s: %s\r\n", k, v)
}
body := "body"
msg += "\r\n" + body
message.Raw = base64.StdEncoding.EncodeToString([]byte(msg))
s.Service.Users.Messages.Send("me", &message).Do()
The email successfully sends but in my inbox, I see the name as "abc" instead of "CUSTOM NAME". Any idea how I fix this?"