Help needed for C++ SMTP Client

Hi, may i know how do i take in user inputs and set them for "Subject", "To" and "From"?

my code:
write(sockfd,"DATA\r\n",strlen("DATA\r\n"));
strcpy (msgToSvr, "");
cin.getline(body, 99, '\n');
strcat (msgToSvr, subject);
strcat (msgToSvr, "\r\n");
write(sockfd,msgToSvr,strlen(msgToSvr));
strcpy (msgToSvr, "");
cin.getline(body, 99, '\n');
strcat (msgToSvr, from);
strcat (msgToSvr, "\r\n");
write(sockfd,msgToSvr,strlen(msgToSvr));
strcpy (msgToSvr, "");
cin.getline(body, 99, '\n');
strcat (msgToSvr, to);
strcat (msgToSvr, "\r\n");
write(sockfd,msgToSvr,strlen(msgToSvr));
write(sockfd,"\r\n",strlen("\r\n"));

===

char subject[100], from[100], to[100] are all input from user.

however when i check my mail.. the subject, from, and to are in my message body. They should not be in the body..

right now i'm getting

Subject: Hello
From: John
To: Peter

in the body.

how do i get the user inputs and assign them to the proper places?

Hi, the data command is after all the headers ... you're all kidding right ? :stuck_out_tongue: