A simple SMTP client program

With a basic understanding of both SMTP and the email format, we are ready to program a simple email client. Our client takes as inputs: the destination email server, the recipient's address, the sender's address, the email subject line, and the email body text.

Our program begins by including the necessary headers with the following statements:

/*smtp_send.c*/#include "chap08.h"#include <ctype.h>#include <stdarg.h>

We also define the following two constants to make buffer allocation and checking easier:

/*smtp_send.c continued*/#define MAXINPUT 512#define MAXRESPONSE 1024

Our program needs to prompt the user for input several times. This is required to get the email server's hostname, the recipient's address, ...

Get Hands-On Network Programming with C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.