}
for (final Mail.Attachment attachment : mail.getAttachments()) {
if (attachment.getData() != null) {
api.addAttachment(attachment.getName(), attachment.getData(), attachment.getMimeType(), attachment.getDescription(), attachment.getDisposition());
} else {
api.addAttachment(attachment.getName(), attachment.getFile(), attachment.getDescription(), attachment.getDisposition());
}
}
if (mail.getBody().isBoth()) {
// sends both text and html
api.send(mail.getBody().getText(), mail.getBody().getHtml());