1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_MAIL_RCPT
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_MAIL_AUTH (3)
9  - CURLOPT_MAIL_FROM (3)
10---
11
12# NAME
13
14CURLOPT_MAIL_RCPT - list of SMTP mail recipients
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_RCPT,
22                          struct curl_slist *rcpts);
23~~~
24
25# DESCRIPTION
26
27Pass a pointer to a linked list of recipients to pass to the server in your
28SMTP mail request. The linked list should be a fully valid list of
29**struct curl_slist** structs properly filled in. Use
30curl_slist_append(3) to create the list and curl_slist_free_all(3)
31to clean up an entire list.
32
33When performing a mail transfer, each recipient should be specified within a
34pair of angled brackets (<>), however, should you not use an angled bracket as
35the first character libcurl assumes you provided a single email address and
36encloses that address within brackets for you.
37
38When performing an address verification (**VRFY** command), each recipient
39should be specified as the user name or user name and domain (as per Section
403.5 of RFC 5321).
41
42When performing a mailing list expand (**EXPN** command), each recipient
43should be specified using the mailing list name, such as "Friends" or
44"London-Office".
45
46# DEFAULT
47
48NULL
49
50# PROTOCOLS
51
52SMTP
53
54# EXAMPLE
55
56~~~c
57int main(void)
58{
59  CURL *curl = curl_easy_init();
60  if(curl) {
61    CURLcode res;
62    struct curl_slist *list;
63    list = curl_slist_append(NULL, "root@localhost");
64    list = curl_slist_append(list, "person@example.com");
65    curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
66    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, list);
67    res = curl_easy_perform(curl);
68    curl_slist_free_all(list);
69    curl_easy_cleanup(curl);
70  }
71}
72~~~
73
74# AVAILABILITY
75
76Added in 7.20.0. The **VRFY** and **EXPN** logic was added in 7.34.0
77
78# RETURN VALUE
79
80Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
81