среда, 25 февраля 2015 г.

Alfresco 5.0.a Send Email with attachments

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

What do you need to do:

  1. Download amp 
  2. Put this file into {Alfresco}/amps folder
  3. Stop Alfresco
  4. Run script {Alfresco}/bin/apply_amps.sh
  5. Run Alfresco
  6. 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);






2 комментария :

  1. Hi Sergey,

    I am using alfresco 5.2 and trying to achieve the same functionality through js. I want multiple attachments to be sent to a recipient. I have used your js given in this blog, able to send mail but without attachments. Kindly help me to send mail with attachments.

    ОтветитьУдалить
  2. Hi Owais,

    I am not sure that it will work on Alfresco 5.2. The AMP was developed for Alfresco 5.0.a, so maybe it requires some changes in the code...

    ОтветитьУдалить