MimeMessage
writeTo
public void writeTo(java.io.OutputStream os)
             throws java.io.IOException,
                    MessagingException
Output the message as an RFC 822 format stream. 
Note that, depending on how the messag was constructed, it may use a variety of line termination conventions. Generally the output should be sent through an appropriate FilterOutputStream that converts the line terminators to the desired form, either CRLF for MIME compatibility and for use in Internet protocols, or the local platform's line terminator for storage in a local text file. This implementation calls the writeTo(OutputStream, String[]) method with a null ignore list.Specified by: 
writeTo in interface Part
Throws:
java.io.IOException - if an error occurs writing to the stream or if an error is generated by the javax.activation layer.
MessagingException -  
See Also: 
DataHandler.writeTo(java.io.OutputStream)