Hi, may i know how do i take in user inputs and set them for "Subject", "To" and "From"?
===
my code:
write(sockfd,"D ATA\r\n",strlen ("DATA\r\n") );
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, subject);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, from);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, to);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
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?
===
my code:
write(sockfd,"D ATA\r\n",strlen ("DATA\r\n") );
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, subject);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, from);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
strcpy (msgToSvr, "");
cin.getline(bod y, 99, '\n');
strcat (msgToSvr, to);
strcat (msgToSvr, "\r\n");
write(sockfd,ms gToSvr,strlen(m sgToSvr));
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?
Comment