protected void send (InternetAddress from, InternetAddress to, String subject,
File file)
{
JavaMailClient mc = new JavaMailClient (System.getProperty("mail.smtp.host"));
AttachmentMessage message = new AttachmentMessage (mc.getSession ());
try {
message.setFrom(from);
message.setRecipient (Message.RecipientType.TO, to);
message.setSubject (subject);
message.attachDescription ("Test message", MimeEnumType.eTextPlain);
//ByteArrayDataSource ds = new ByteArrayDataSource ("A short little message".getBytes (), MimeEnumType.eTextXml.toString ());
//ds.setName ("test.txt");
//message.attach (ds);
if (file != null) {
message.attachFile (file);
}
message.prepareToSend ();
}
catch (MessagingException exc) {
myLog.error ("send", exc);
}
mc.send(message);