Closing the Mail Transfer Session
The dataClose() method in both the RWSmtpClient and RWSmtpAgent classes needs to be called at the end of each data (mail) transfer session. This is because the dataClose() method inserts the end-of-mail indicator—a period contained on a line by itself—before the data channel is closed.
Because a mail message can have a period alone on a line, the SMTP protocol requires that any line with a leading period be sent with two leading periods. You can use the Internet Basics global function rwAddPeriods() to add the necessary periods.
Example 25 – Adding periods
#include "rw/internet/util.h"
 
RWCString msg = getRealMessage();
msg = rwAddPeriods(msg);
// now transfer msg using SMTP