02-15-2008
5,
0
Join Date: Jan 2008
Last Activity: 15 February 2008, 11:14 AM EST
Posts: 5
Thanks Given: 0
Thanked 0 Times in 0 Posts
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?