1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_MAIL_AUTH
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_MAIL_FROM (3)
9  - CURLOPT_MAIL_RCPT (3)
10---
11
12# NAME
13
14CURLOPT_MAIL_AUTH - SMTP authentication address
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_AUTH, char *auth);
22~~~
23
24# DESCRIPTION
25
26Pass a pointer to a null-terminated string as parameter. This is used to
27specify the authentication address (identity) of a submitted message that is
28being relayed to another server.
29
30This optional parameter allows co-operating agents in a trusted environment to
31communicate the authentication of individual messages and should only be used
32by the application program, using libcurl, if the application is itself a mail
33server acting in such an environment. If the application is operating as such
34and the AUTH address is not known or is invalid, then an empty string should
35be used for this parameter.
36
37Unlike CURLOPT_MAIL_FROM(3) and CURLOPT_MAIL_RCPT(3), the address
38should not be specified within a pair of angled brackets (<>). However, if an
39empty string is used then a pair of brackets are sent by libcurl as required
40by RFC 2554.
41
42The application does not have to keep the string around after setting this
43option.
44
45# DEFAULT
46
47NULL
48
49# PROTOCOLS
50
51SMTP
52
53# EXAMPLE
54
55~~~c
56int main(void)
57{
58  CURL *curl = curl_easy_init();
59  if(curl) {
60    CURLcode res;
61    curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
62    curl_easy_setopt(curl, CURLOPT_MAIL_AUTH, "<secret@cave>");
63    res = curl_easy_perform(curl);
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71Added in 7.25.0
72
73# RETURN VALUE
74
75Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
76CURLE_OUT_OF_MEMORY if there was insufficient heap space.
77