GNURLOPT_MAIL_AUTH(3)

๐Ÿ“ฆ version 7.72.0, in nixos 26.05, nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

okay so this is GNURLOPT_MAIL_AUTH(3), one of the curl_easy_setopt options, and it's giving SMTP authentication address energy. That's the whole name: CURLOPT_MAIL_AUTH โ€” SMTP authentication address. slay. ๐ŸŽ€

๐Ÿ› ๏ธ SYNOPSIS ๐Ÿ› ๏ธ

bestie, here's the include and the signature, no cap:

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_AUTH, char *auth);

๐Ÿ’ฌ DESCRIPTION ๐Ÿ’ฌ

okay so you pass a pointer to a null-terminated string as the parameter. That string is used to specify the authentication address (identity) of a submitted message that's being relayed to another server. ๐Ÿ‘‘

This optional parameter lets co-operating agents in a trusted environment communicate the authentication of individual messages, and it should only be used by the application program, using libcurl, if the application is itself a mail server acting in such an environment. if your app is operating as such and the AUTH address is not known or is invalid, then an empty string should be used for this parameter. periodt. ๐Ÿ’…

unlike CURLOPT_MAIL_FROM(3) and CURLOPT_MAIL_RCPT(3), the address should not be specified within a pair of angled brackets (<>). however!! if an empty string is used, then a pair of brackets will be sent by libcurl as required by RFC2554. iconic behavior, honestly. ๐ŸŒˆ

and the application does not have to keep the string around after setting this option โ€” set it and forget it, bestie. ๐Ÿซถ

๐ŸŽ€ DEFAULT ๐ŸŽ€

NULL โ€” the default is literally nothing, and that's valid. ๐Ÿ’€

๐Ÿ“ฎ PROTOCOLS ๐Ÿ“ฎ

SMTP only, bestie. ๐Ÿ“จ

๐Ÿงช EXAMPLE ๐Ÿงช

here's the example, copied exactly with all its vibes:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
  curl_easy_setopt(curl, CURLOPT_MAIL_AUTH, "<secret@cave>");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

๐Ÿ•ฐ๏ธ AVAILABILITY ๐Ÿ•ฐ๏ธ

Added in 7.25.0. vintage cutie behavior. ๐Ÿ•ฐ๏ธโœจ

๐Ÿ” RETURN VALUE ๐Ÿ”

Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. no cap. ๐Ÿซก

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


mwah ๐Ÿ’‹ โ€” this page was from libcurl 7.37.0, dated 19 Jun 2014, and the manual name is GNURLOPT_MAIL_AUTH(3). periodt, bestie. ๐Ÿ’–

๐Ÿ“ฆ where this page comes from