Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using SMTP server to send mail from c++

Status
Not open for further replies.

drewdaman

Programmer
Aug 5, 2003
302
0
0
CA
Hello,

I am trying to connect to an SMTP server and send an email from my code. I can connect, authenticate myself, and send an email so far. What happens is that the email that is sent has the name of the sender, subject, recepients, BUT the body of the message does not get transmitted.

i'm posting some code where i send the subject, from, to fields and body.

Code:
	memset(command,0,sizeof(command));
	strcpy(command, "FROM: Sigpro Wireless<dhruvsmathur@rogers.com>");
	len=strlen(command);
	command[len]=0x0D;
	command[len+1]=0x0A;
	len++;
	e.sendTCPtoServer(command, len+1);

	memset(command,0,sizeof(command));
	strcpy(command, "TO: <dhruvsmathur@rogers.com>");
	len=strlen(command);
	command[len]=0x0D;
	command[len+1]=0x0A;
	len++;
	e.sendTCPtoServer(command, len+1);

	memset(command,0,sizeof(command));
	strcpy(command, "Subject: code test");
	len=strlen(command);
	command[len]=0x0D;
	command[len+1]=0x0A;
	len++;
	e.sendTCPtoServer(command, len+1);

	memset(command,0,sizeof(command));
	strcpy(command, "<this is the body>");
//	strcat(command,">");
	len=strlen(command);
	command[len]=0x0D;
	command[len+1]=0x0A;
	len++;
	e.sendTCPtoServer(command, len+1);

	memset(command,0,sizeof(command));
	strcpy(command,".");
	len=strlen(command);
	command[len]=0x0D;
	command[len+1]=0x0A;
	len++;
	e.sendTCPtoServer(command, len+1);

i check mail from outlook express and i am also able to check this account on the web through internet explorer.
when i check my mail using IE, the text that i want to send as teh body of the message, appears... but it appears just under the subject line.. the TO, FROM, SUBJECT etc appear in a table and the body text appears below this table (under normal circumstances)... but with the code that i have, the body text appears in the table. so i'm guessing there is something (some sort of tag or other indicator) that separates the TO, FROM, SUBJECT fields from the actual text.. do you know what this should be?also, the text that i want to send as the body does not appear in OE. (but you can see it when you go to the message's properties- right click on the message in the inbox, go to properties, details tab).

hope someone can help me out with this!

thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top