public void writeBodyFromString(String bodyAsString, Charset charset) {
        message.contentEncoding(charset.name())
                .contentType(Message.TEXT_PLAIN);
        byte[] bodyContent = bodyAsString.getBytes(charset);
        message.body(bodyContent);
    }
public void writeBodyFromString ( String bodyAsString , Charset charset ) { message . contentEncoding ( charset . name ( ) ) . contentType ( Message . TEXT_PLAIN ) ; byte [ ] bodyContent = bodyAsString . getBytes ( charset ) ; message . body ( bodyContent ) ; }
Writes the message body from a string using the given charset
as encoding and setting the content type to text/plain.

@param bodyAsString Body to write as string
@param charset The charset to encode the string