// Send several emails in a batch.
LOGGER.log(Level.INFO, "Inserting " + Integer.toString(ITEMS_TO_BATCH)
+ " mail items in a batch.");
try {
MailItemFeed feed = batchInsertMailItems(entries);
// Check for failure in the returned entries.
int failedInsertions = 0, successfulInsertions = 0;
for (MailItemEntry returnedEntry : feed.getEntries()) {
if (BatchUtils.isFailure(returnedEntry)) {
BatchStatus status = BatchUtils.getBatchStatus(returnedEntry);
LOGGER.log(Level.SEVERE, "Entry "
+ BatchUtils.getBatchId(returnedEntry) + " failed insertion: "
+ status.getCode() + " " + status.getReason());