smtp: allow suffix behind a mail address for RFC 3461

Verified in test 3215

Closes #16643
This commit is contained in:
Dominik Tomecki 2025-07-30 09:48:13 +02:00 committed by Daniel Stenberg
parent 3ccffad28d
commit 450c00f983
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 98 additions and 19 deletions

View file

@ -32,6 +32,9 @@ to specify the sender's email address when sending SMTP mail with libcurl.
An originator email address should be specified with angled brackets (\<\>)
around it, which if not specified are added automatically.
In order to specify DSN parameters (as per RFC 3461), the address has to be
written in angled brackets, followed by the parameters.
If this parameter is not specified then an empty address is sent to the SMTP
server which might cause the email to be rejected.

View file

@ -40,6 +40,9 @@ pair of angled brackets (\<\>), however, should you not use an angled bracket
as the first character libcurl assumes you provided a single email address and
encloses that address within brackets for you.
In order to specify DSN parameters (as per RFC 3461), the address has to be
written in angled brackets, followed by the parameters.
When performing an address verification (**VRFY** command), each recipient
should be specified as the username or username plus domain (as per Section
3.5 of RFC 5321).
@ -68,6 +71,7 @@ int main(void)
struct curl_slist *list;
list = curl_slist_append(NULL, "root@localhost");
list = curl_slist_append(list, "person@example.com");
list = curl_slist_append(list, "<other@example.com> NOTIFY=SUCCESS");
curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, list);
res = curl_easy_perform(curl);