summaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2020-02-13 22:56:51 +0000
committerSteve Holme <steve_holme@hotmail.com>2020-02-26 14:54:51 +0000
commitefce3ea5a85126d3e6c2084a7b581cc1df1b340b (patch)
tree45c0a49cfcf0bfad2c8041d460e8bdeeb41c6818 /lib/smtp.c
parent483edeb8dda80406f56480965d3c649bb3b2e77b (diff)
downloadcurl-efce3ea5a85126d3e6c2084a7b581cc1df1b340b.tar.gz
smtp: Support the SMTPUTF8 extension in the VRFY command
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index ef51c829a..362e8eae9 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -491,6 +491,12 @@ static CURLcode smtp_perform_command(struct connectdata *conn)
char *address = NULL;
struct hostname host = { NULL, NULL, NULL, NULL };
+ /* We notify the server we are sending UTF-8 data if a) it supports the
+ SMTPUTF8 extension and b) The mailbox contains UTF-8 charaacters, in
+ either the local address or host name parts. This is regardless of
+ whether the host name is encoded using IDN ACE */
+ bool utf8 = FALSE;
+
/* Parse the mailbox to verify into the local address and host name
parts, converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(conn, smtp->rcpt->data,
@@ -498,12 +504,19 @@ static CURLcode smtp_perform_command(struct connectdata *conn)
if(result)
return result;
+ /* Establish whether we should report SMTPUTF8 to the server for this
+ mailbox as per RFC-6531 sect. 3.1 point 6 */
+ utf8 = (conn->proto.smtpc.utf8_supported) &&
+ ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
+ (!Curl_is_ASCII_name(host.name)));
+
/* Send the VRFY command (Note: The host name part may be absent when the
host is a local system) */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "VRFY %s%s%s",
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "VRFY %s%s%s%s",
address,
host.name ? "@" : "",
- host.name ? host.name : "");
+ host.name ? host.name : "",
+ utf8 ? " SMTPUTF8" : "");
Curl_free_idnconverted_hostname(&host);
free(address);