JavaMail has a ByteArrayDataSource
that you can use for this purpose:
DataSource ds = new ByteArrayDataSource(theString, "text/plain; charset=UTF-8");
DataHandler handler = new DataHandler(ds);
The charset
in the mime type determines what encoding it will use to convert the string to bytes.