CURLOPT_MAIL_FROM.3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .\" generated by cd2nroff 0.1 from CURLOPT_MAIL_FROM.md
  2. .TH CURLOPT_MAIL_FROM 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_MAIL_FROM \- SMTP sender address
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAIL_FROM, char *from);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a null\-terminated string as parameter. This should be used
  12. to specify the sender\(aqs email address when sending SMTP mail with libcurl.
  13. An originator email address should be specified with angled brackets (<>)
  14. around it, which if not specified are added automatically.
  15. If this parameter is not specified then an empty address is sent to the SMTP
  16. server which might cause the email to be rejected.
  17. The application does not have to keep the string around after setting this
  18. option.
  19. .SH DEFAULT
  20. blank
  21. .SH PROTOCOLS
  22. This functionality affects smtp only
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. CURL *curl = curl_easy_init();
  28. if(curl) {
  29. CURLcode res;
  30. curl_easy_setopt(curl, CURLOPT_URL, "smtp://example.com/");
  31. curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "president@example.com");
  32. res = curl_easy_perform(curl);
  33. curl_easy_cleanup(curl);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.20.0
  39. .SH RETURN VALUE
  40. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  41. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  42. .SH SEE ALSO
  43. .BR CURLOPT_MAIL_AUTH (3),
  44. .BR CURLOPT_MAIL_RCPT (3)