ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gs = new GZIPOutputStream(baos);
m.writeTo(gs);
gs.finish();
MailArchiva mailArchiva = null;
MailArchivaService service = new MailArchivaServiceLocator();
try
{
mailArchiva = service.getMailArchiva(mailArchivaServerURL);
mailArchiva.storeMessage(baos.toByteArray());
}
catch (Exception e)
{
log.error("failed to connect to mailarchiva server {url='" + mailArchivaServerURL.getHost() + "'}", e);