As jwSMTP has to create MIME messages when using attachments it has to base64 encode data. Because of this there are a couple of helper functions for the mailer class in the library, unimaginatively called base64encode.
std::vector<char> base64encode(const std::vector<char>& input, const bool returns = true);
std::string base64encode(const std::string& input, const bool returns = true);
These can be used for binary or string data respectively. Why the
returns = true part? This is to make sure that jwSMTP complies with the smtp protocol and keeps the line lengths under 1000 characters. Call these functions with this parameter set to false, please note don't think that if your data is less than 1000 characters you don't need to set this, this is not true as jwSMTP puts in a line feed every 80 characters or so.
Why is there no decode function? As jwSMTP only sends mail it does not ever have to decode messages, i.e. no need for base64decode, and will probably not ever get this function. jwSMTP is a minimal library, i.e. keep it simple.
JohnWiggins.net
email me about