diff options
author | Steve Holme <steve_holme@hotmail.com> | 2020-02-13 22:39:28 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2020-02-26 14:54:51 +0000 |
commit | 483edeb8dda80406f56480965d3c649bb3b2e77b (patch) | |
tree | 6289d980b723e76d30f4e4e1eac776b2bf20fb6e /lib | |
parent | aba1bf630f13a77b1a92484feb365a29bb1a25da (diff) |
smtp: Support the SMTPUTF8 extension in the RCPT TO command
Note: The RCPT TO command isn't required to advertise to the server that
it contains UTF-8 characters, instead the server is told that a mail may
contain UTF-8 in any envelope command via the MAIL command.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smtp.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index cdeeb7a26..ef51c829a 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -670,6 +670,23 @@ static CURLcode smtp_perform_mail(struct connectdata *conn) } } + /* If the mailboxes in the FROM and AUTH parameters don't include a UTF-8 + based address then quickly scan through the recipient list and check if + any there do, as we need to correctly identify our support for SMTPUTF8 + in the envelope, as per RFC-6531 sect. 3.4 */ + if(conn->proto.smtpc.utf8_supported && !utf8) { + struct SMTP *smtp = data->req.protop; + struct curl_slist *rcpt = smtp->rcpt; + + while(rcpt && !utf8) { + /* Does the host name contain non-ASCII characters? */ + if(!Curl_is_ASCII_name(rcpt->data)) + utf8 = TRUE; + + rcpt = rcpt->next; + } + } + /* Send the MAIL command */ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:%s%s%s%s%s%s", @@ -679,7 +696,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn) size ? " SIZE=" : "", /* Optional on SIZE support */ size ? size : "", /* */ utf8 ? " SMTPUTF8" /* Internationalised mailbox */ - : ""); /* address included */ + : ""); /* included in our envelope */ free(from); free(auth); |