for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();)
{
Map.Entry entry = (Map.Entry)iterator.next();
email.setHeader(entry.getKey().toString(), entry.getValue().toString());
}
EmailWithAttachmentMessage emailMessage = (EmailWithAttachmentMessage)src;
// Create Multipart to put BodyParts in
Multipart multipart = new MimeMultipart();
// Create Text Message
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(emailMessage.getTextMessage());
multipart.addBodyPart(messageBodyPart);
// Create Attachment
DataHandler[] data = emailMessage.getAttachments();
for (int i = 0; i < data.length; i++)
{
messageBodyPart = new MimeBodyPart();
DataHandler dataHandler = data[i];
messageBodyPart.setDataHandler(dataHandler);