As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
var mail = actions.create('mail'); mail.parameters.to = 'a@b.com'; // or maybe person.properties["cm:email"]; mail.parameters.from = 'alfresco@system.com'; mail.parameters.subject = 'Please Review this Document'; mail.parameters.text = 'Blah blah blah\n\n'; mail.parameters.text += 'Doc: http://www.srv.com/alfresco/d/a/workspace/SpacesStore/a9...fd/doc.pdf'; mail.execute(document);
for (final NodeRef attachmentNodeRef : attachments) { final MimeBodyPart attachment = new MimeBodyPart(); attachment.setDataHandler(new DataHandler(new DataSource() { public InputStream getInputStream() throws IOException { ContentReader reader = contentService.getReader(attachmentNodeRef, ContentModel.PROP_CONTENT); return reader.getContentInputStream(); } public OutputStream getOutputStream() throws IOException { throw new IOException("Read-only data"); } public String getContentType() { return contentService.getReader(attachmentNodeRef, ContentModel.PROP_CONTENT).getMimetype(); } public String getName() { return nodeService.getProperty(attachmentNodeRef, ContentModel.PROP_NAME).toString(); } })); attachment.setFileName(nodeService.getProperty(attachmentNodeRef, ContentModel.PROP_NAME).toString()); content.addBodyPart(attachment); }