mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:43:34 +03:00
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.
This commit is contained in:
parent
aba1bf630f
commit
483edeb8dd
4 changed files with 91 additions and 6 deletions
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue