use of eu.ggnet.dwoss.mandator.api.value.partial.ListingMailConfiguration in project dwoss by gg-net.
the class SalesListingProducerOperation method prepareAndSend.
/**
* Prepare and send filejackets to the specified email address.
* <p>
* @param fileJackets files to be send
*/
private void prepareAndSend(List<FileJacket> fileJackets) {
SubMonitor m = monitorFactory.newSubMonitor("Transfer");
m.message("sending Mail");
m.start();
try {
ListingMailConfiguration config = listingService.get().listingMailConfiguration();
MultiPartEmail email = mandator.prepareDirectMail();
email.setFrom(config.getFromAddress());
email.addTo(config.getToAddress());
email.setSubject(config.getSubject());
email.setMsg(config.toMessage());
for (FileJacket fj : fileJackets) {
email.attach(new javax.mail.util.ByteArrayDataSource(fj.getContent(), "application/xls"), fj.getHead() + fj.getSuffix(), "Die Händlerliste für die Marke ");
}
email.send();
m.finish();
} catch (EmailException e) {
throw new RuntimeException(e);
}
}
Aggregations