Libcurl uses the following to define the email recipient:
#define RECIPIENT "<bla@bla.com>"
But what if I don’t want to hard code the recipient? I want a user to be able to supply his/her own email address, so I need to find a way to do this:
std::string emailreceiver = "bla@bla.com";
#define RECIPIENT = emailreceiver
The recipient is used in this line:
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
I’m assuming I can’t simply change this to
std::string emailreceiver = "bla@bla.com";
rcpt_list = curl_slist_append(rcpt_list, emailreceiver);
Anyone have any suggestions?
Curl expects a C string (
const char *), not a C++ string (std::string). So try:There’s no need to use a
#defineat all, that was just an example.