Fill the MIME Part From the String
The
RWMimePart class provides a
fromString() function that parses a MIME message contained within a string and populates the message with the string’s contents. For example:
RWCString mimedata;
// ... fill mimedata with a MIME message
RWMimePart message;
try
{
message.fromString(mimedata);
}
catch (const RWMimeParseError& msg)
{
// The fromString function could not parse the complete message.
// ...handle the exception
}
The function extracts as much data as possible from the message. Typically, this is the full message. However, if the function can’t find any way to make sense of the message, the function throws
RWMimeParseError. We use this strategy so that the MIME package can process as many messages as possible – even some messages that don’t meet the specification or that were damaged in transit.