B
Bill
I am trying to write a small SMTP client. You enter the IP address of the
SMTP server & an EM address & it should send a message with the time to &
from the EM addr similar to a telnet SMTP test.
I have verified that I can send a message with telnet. What the PGM does
is connect to the server, HELO, then send the MAIL FROM:[email protected]. then
it just waits. Its like the server does not receive the MAIL FROM:.
The server (Exchange 2K) log file shows the HELO & a QUIT when I hit
<ctrl> c to stop the program.
What am I missing about an MTP connection?
------------------------PGM----
This builds the mail from: line.
//mail from: - Sender.
strcpy (messageToServer, "mail from:");
strcat (messageToServer, *(argv + 2));
strcat (messageToServer, "\r\n");
sendLine (messageToServer, socketFD);
This send the message to the server.
int sendLine (char message[], int socketFD)
{
/*cout << sizeof (message) << "\t"; //sizeof does not work.
bytesSent = send (socketFD, message, 29, 0);
cout << bytesSent <<"\t";
if (bytesSent == -1)
*/if (send (socketFD, message, 29, 0) == -1)
{
perror ("send");
exit (1);
}
else
{
cout << "Message to server was: " << message;
}
return 0;
------------------------END----
Bill
SMTP server & an EM address & it should send a message with the time to &
from the EM addr similar to a telnet SMTP test.
I have verified that I can send a message with telnet. What the PGM does
is connect to the server, HELO, then send the MAIL FROM:[email protected]. then
it just waits. Its like the server does not receive the MAIL FROM:.
The server (Exchange 2K) log file shows the HELO & a QUIT when I hit
<ctrl> c to stop the program.
What am I missing about an MTP connection?
------------------------PGM----
This builds the mail from: line.
//mail from: - Sender.
strcpy (messageToServer, "mail from:");
strcat (messageToServer, *(argv + 2));
strcat (messageToServer, "\r\n");
sendLine (messageToServer, socketFD);
This send the message to the server.
int sendLine (char message[], int socketFD)
{
/*cout << sizeof (message) << "\t"; //sizeof does not work.
bytesSent = send (socketFD, message, 29, 0);
cout << bytesSent <<"\t";
if (bytesSent == -1)
*/if (send (socketFD, message, 29, 0) == -1)
{
perror ("send");
exit (1);
}
else
{
cout << "Message to server was: " << message;
}
return 0;
------------------------END----
Bill