Several days ago I was faced with a problem that Alfresco doesn't allow to send email with attachments and I written small patch to add this feature. I believe this AMP will be useful for somebody.
Addon was tested on Alfresco 5.0.a
Addon was tested on Alfresco 5.0.a
What do you need to do:
- Download amp
- Put this file into {Alfresco}/amps folder
- Stop Alfresco
- Run script {Alfresco}/bin/apply_amps.sh
- Run Alfresco
- After that you will get ability to send email with attachments
How to send email with attachments (example):
// create email
var mail = actions.create("mail");
// set receiver of the email
mail.parameters.to = "to.somebody@gmail.com";
// set mail subject
mail.parameters.subject = "Email with attachments";
// set sender of the email
mail.parameters.from = "from.somebody@gmail.com";
// set mail body
mail.parameters.text = "This is my first email with attachments";
// initialize array of attachments
var array = [];
//add document to array
array.push(document.nodeRef);
//add one more document to array
array.push(document1.nodeRef);
// add attachments to the email
mail.parameters.attachments = array;
// send email
mail.execute(document);