private JsonObject send(List<JsonObject> emails) {
MimeEmailFactory emailFactory = DefaultMimeEmailFactory.getInstance();
List<JsonObject> successful = new ArrayList<JsonObject>();
List<JsonObject> error = new ArrayList<JsonObject>();
for(JsonObject json : emails) {
MimeEmail email;
try {
email = emailFactory.createMimeEmail(json);
if(email != null) {
email.send();
successful.add(json);
} else {
error.add(createErrorResponse(json, "Email could not be created from JSON."));
}
} catch (MimeEmailException e) {