mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:43:33 +03:00
smtp: Support the SMTPUTF8 extension in the MAIL command
Support the SMTPUTF8 extension when sending mailbox information in the MAIL command (FROM and AUTH parameters). Non-ASCII domain names will be ACE encoded, if IDN is supported, whilst non-ASCII characters in the local address part are passed to the server. Reported-by: ygthien on github Fixes #4828
This commit is contained in:
parent
4754c55cd7
commit
aba1bf630f
4 changed files with 111 additions and 19 deletions
|
|
@ -813,6 +813,7 @@ sub MAIL_smtp {
|
|||
else {
|
||||
my $from;
|
||||
my $size;
|
||||
my $smtputf8 = grep /^SMTPUTF8$/, @capabilities;
|
||||
my @elements = split(/ /, $args);
|
||||
|
||||
# Get the FROM and SIZE parameters
|
||||
|
|
@ -827,11 +828,11 @@ sub MAIL_smtp {
|
|||
|
||||
# Validate the from address (only <> and a valid email address inside
|
||||
# <> are allowed, such as <user@example.com>)
|
||||
if ((!$from) || (($from ne "<>") && ($from !~
|
||||
/^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/))) {
|
||||
sendcontrol "501 Invalid address\r\n";
|
||||
}
|
||||
else {
|
||||
if (($from eq "<>") ||
|
||||
(!$smtputf8 && $from =~
|
||||
/^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/) ||
|
||||
($smtputf8 && $from =~
|
||||
/^<([a-zA-Z0-9\x{80}-\x{ff}._%+-]+)\@(([a-zA-Z0-9\x{80}-\x{ff}-]+)\.)+([a-zA-Z]{2,4})>$/)) {
|
||||
my @found;
|
||||
my $valid = 1;
|
||||
|
||||
|
|
@ -852,6 +853,9 @@ sub MAIL_smtp {
|
|||
sendcontrol "250 Sender OK\r\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
sendcontrol "501 Invalid address\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue