Create a MIME String

The MIME part is now complete and ready to use. To send the message over a network, convert the message into a MIME string using the asString() function, as shown:

 

RWMimeMultipart multipartMessage;

 

// ... fill message as described above

 

RWCString msgString;

 

try

{

msgString = multipartMessage.asString();

}

catch (const RWMimeError& msg)

{

// Handle the error

}

The asString() function doesn’t enforce a particular part style, or even guarantee that the part is correct MIME. The function does contain some safeguards that prevent a program from generating an unintelligible message. If the function cannot produce a structurally correct MIME message, the function throws RWMimeError.