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 /tests/ftpserver.pl | |
parent | aba1bf630f13a77b1a92484feb365a29bb1a25da (diff) | |
download | curl-483edeb8dda80406f56480965d3c649bb3b2e77b.tar.gz |
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 'tests/ftpserver.pl')
-rwxr-xr-x | tests/ftpserver.pl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index fe74f8b07..9c4b88aef 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -871,16 +871,19 @@ sub RCPT_smtp { sendcontrol "501 Unrecognized parameter\r\n"; } else { + my $smtputf8 = grep /^SMTPUTF8$/, @capabilities; my $to = $1; # Validate the to address (only a valid email address inside <> is # allowed, such as <user@example.com>) - if ($to !~ - /^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/) { - sendcontrol "501 Invalid address\r\n"; + if ((!$smtputf8 && $to =~ + /^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/) || + ($smtputf8 && $to =~ + /^<([a-zA-Z0-9\x{80}-\x{ff}._%+-]+)\@(([a-zA-Z0-9\x{80}-\x{ff}-]+)\.)+([a-zA-Z]{2,4})>$/)) { + sendcontrol "250 Recipient OK\r\n"; } else { - sendcontrol "250 Recipient OK\r\n"; + sendcontrol "501 Invalid address\r\n"; } } |