cancel
Showing results for 
Search instead for 
Did you mean: 

Attach a document into an email

mvicidomini
Champ in-the-making
Champ in-the-making
Hello all,

i would like to attach a document when it is uploaded to alfresco. I know that there is the default notification from the workflow but for internal reason my customers ask me to attach the original document into an email. I have writen a small script but i don't manage to attach the document does somebody has a solution thanks a lot.

var mail = actions.create("mail");
var docName = document.properties["name"];
var siteShortName = document.siteShortName;
//var mySite = getSite(shortName);
var prop = document.properties["nodeRef"]
mail.parameters.to = "MY EMAIL";
mail.parameters.subject = "Ajout de document";
mail.parameters.from = "MY EMAIL";
mail.parameters.text = "Ajout du document " + docName + "Sur le site: "+siteShortName+" Projet : "+space.name ;
mail.execute(document);
64 REPLIES 64

gjongerh
Champ in-the-making
Champ in-the-making
Hi rjohnson,
Thank you for sharing, could you please send me your code?
My mail g.jongerhuis@virtorg.nl

Thank you.

vicmutish
Champ in-the-making
Champ in-the-making
Hi rjohnson,

Kindly share with me your code. my email vicmutish@gmail.com.
Regards,

ibol737
Champ in-the-making
Champ in-the-making
Hi rjohnson,
Thank you for sharing, could you please send me your code?
My mail ibol737@gmail.com

Thank you.

mduduzi
Confirmed Champ
Confirmed Champ
Hi rjohnson,
Thank you for sharing, could you please send me your code?
My mail jakarhumba@gmail.com

Thank you.

iomari
Champ in-the-making
Champ in-the-making


Greetings,
I'm using alfresco 5. Will your solution work with this version? If so can you please send it to me?

[email]iomari@gmail.com[/email]

Thanks in advance

bhramari
Champ in-the-making
Champ in-the-making
hI,

PLEASE SEND ME THE CODE TOO. @bhramari.bisht11@gmail.com
i am not abel to send an attachment with my mail and mail.parameters.node=document; doesnt work

bhramari
Champ in-the-making
Champ in-the-making
Hi bob, I did this as you have told, I don't need a template, so have removed the template part

   var file =companyhome.childByNamePath("Guideline-Public-Expiry.csv");
   var fileext= ".csv";
    var mail = actions.create("mail");
    mail.parameters.to = "";
    mail.parameters.subject = "Monthly-Report on Expiry of Documents in Guidelines";
    mail.parameters.from = "";
    mail.parameters.text = "Hi,\Please find attached file of documents that will expire in next 2 months "+document.name;
   mail.parameters.node_to_attach = file; // Here you set document to sent via email
    mail.parameters.attachment_extension = fileext; // Here you set document extension
    mail.execute(document);

please help, it is still not working

bhramari
Champ in-the-making
Champ in-the-making
Hi bob, I did this as you have told, I don't need a template, so have removed the template part

   var file =companyhome.childByNamePath("Guideline-Public-Expiry.csv");
   var fileext= ".csv";
    var mail = actions.create("mail");
    mail.parameters.to = "";
    mail.parameters.subject = "Monthly-Report on Expiry of Documents in Guidelines";
    mail.parameters.from = "";
    mail.parameters.text = "Hi,\Please find attached file of documents that will expire in next 2 months "+document.name;
   mail.parameters.node_to_attach = file; // Here you set document to sent via email
    mail.parameters.attachment_extension = fileext; // Here you set document extension
    mail.execute(document);

please help, it is still not working

rjohnson
Star Contributor
Star Contributor
Whats the error in the logs

bhramari
Champ in-the-making
Champ in-the-making
There are no logs, everything is perfectly working!