POP3 mail messages are terminated by <period> contained on a line by itself. When your application gets a mail drop via an RWSocketPortal, which can be obtained through the portal method of an RWPop3DataReply, it should not look for more data if the termination character is found.
To handle the possibility that a mail message might have a single period on a line, POP3 servers double any period that is the first character in a line. You can use the Internet Basics global function rwRemovePeriods() to replace double periods with single periods.
#include "rw/internet/util.h" void saveMessage (RWPop3Client client) { RWPop3DataReply reply; reply = client.retr(1); // retrieve the first message RWPortalIStream istr(reply.portal()); // construct input stream RWCString body; body.readFile(istr); body = rwRemovePeriods(body); ofstream ostr("save.me"); // construct output stream in save.me RWStreamCoupler couple; couple(istr, ostr, pop3StreamFilter); } |
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.