Everything is not as simple as it seems =) There is a variable It, and so it needs to be inserted instead of The body of the message starts here. \ R \ n Here's the code =)

#include "Header.h" #define FROM_ADDR "lashka.luhovna@yandex.ua" #define TO_ADDR "plavenkov@yandex.ua" #define CC_ADDR "Lasha Luhovna<lashka.luhovna@yandex.ua> (ABC Company), lashka.witch@herssite.com" #define FROM_MAIL "Sender Person " FROM_ADDR #define TO_MAIL "A Receiver " TO_ADDR #define CC_MAIL "Message " CC_ADDR /////////////////////////////////////////// time_t It = time(NULL); static const char *payload_text[] = { "Date: Mon, 10 Nov 2018 21:54:29 +1100\r\n", "To: " TO_MAIL "\r\n", "From: " FROM_MAIL "\r\n", "Cc: " CC_MAIL "\r\n", "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@" "rfcpedant.example.org>\r\n", "Subject: SMTP example message\r\n", "\r\n", /* empty line to divide headers from body, see RFC5322 */ "The body of the message starts here.\r\n", "\r\n", "It could be a lot of lines, could be MIME encoded, whatever.\r\n", "Check RFC5322.\r\n", NULL }; //Дальше идёт ненужная вам шняга =) 
  • I apologize, not a string, but time_t - Simple Company
  • If this is not possible, tell me what to do if It = "Hello"; - Simple Company
  • if It = "Hello", then asprintf(&payload_text[8], "%s\r\n", It); - avp

1 answer 1

 #include <ctime> // ================== // в какой-то функции tm *timeinfo = localtime(&It); char* stime = asctime(timeinfo); 

Well, insert the stime value by your index in the array.

 payload_text[8] = stime;