From b36ed8eddb0e80a52956e5c5e46b1d07dc756b5d Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Thu, 25 Feb 2021 21:15:16 +0000 Subject: [PATCH] net/smtp: adds support for the SMTPUTF8 extension Obtained from: https://github.com/golang/go/issues/19860 --- smtp.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smtp.go b/smtp.go index c7557c3..a37d90c 100644 --- a/smtp.go +++ b/smtp.go @@ -242,7 +242,8 @@ func (c *Client) Auth(a smtp.Auth) error { // Mail issues a MAIL command to the server using the provided email address. // If the server supports the 8BITMIME extension, Mail adds the BODY=8BITMIME -// parameter. +// parameter. If the server supports the SMTPUTF8 extension, Mail adds the +// SMTPUTF8 parameter. // This initiates a mail transaction and is followed by one or more Rcpt calls. func (c *Client) Mail(from string) error { if err := validateLine(from); err != nil { @@ -256,6 +257,9 @@ func (c *Client) Mail(from string) error { if _, ok := c.ext["8BITMIME"]; ok { cmdStr += " BODY=8BITMIME" } + if _, ok := c.ext["SMTPUTF8"]; ok { + cmdStr += " SMTPUTF8" + } } _, _, err := c.cmd(250, cmdStr, from) return err