I am sending e-mails over smtp in golang, which works perfectly fine. To set the sender of an e-mail I use the Client.Mail funtion:
func (c *Client) Mail(from string) error
When the recipient gets the e-mail he sees the sender as plaintext e-mail address: [email protected]
I want the sender to be displayed like: Sandy Sender <[email protected]>.
Is this possible? I tried setting the sender to Sandy Sender <[email protected]> or only Sandy Sender but none of them work. I get the error 501 5.1.7 Invalid address
You need to set the
Fromfield of your mail toSandy Sender <[email protected]>:And use the address only (
[email protected]) inClient.Mail.Alternatively, you can use my package Gomail: