Notification.SendMail and files

I m trying to send all the files attached to the children of a folder as attachments in a single mail. What syntax is expected for such a use of the files parameter of the sendMail operation ?

0 votes

1 answers

1280 views

ANSWER



Workaround :

Get Children of Folder
Get files
Zip
Create Document
Set File
Send email
Delete document

I did not even manage to do it without a temporary doc !

0 votes



You should not have to create a Nuxeo document. Can you post your code?
10/10/2012

Thanks.

My chain :

    <chain id="reunion_send_mail_zip">
      <operation id="Context.FetchDocument"/>
      <operation id="Context.RunDocumentOperation">
        <param type="string" name="id">get_user_read</param>
        <param type="boolean" name="isolate">false</param>
      </operation>
      <operation id="Context.SetVar">
        <param type="string" name="name">exterieurs</param>
        <param type="object" name="value">expr:Document["reunion:participants_mail"]</param>
      </operation>
      <operation id="Context.RunScript">
        <param type="string" name="script">Context["liste_exterieurs"] = new String() ;
foreach ( exterieur : Context["exterieurs"])
{
    Context["liste_exterieurs"] = Context["liste_exterieurs"] + exterieur + ',' ;
}
Context["liste_exterieurs"] = Context["liste_exterieurs"].substring(0,Context["liste_exterieurs"].length()-1);</param>
      </operation>
      <operation id="Document.Push"/>
      <operation id="Document.GetChildren"/>
      <operation id="Context.SetInputAsVar">
        <param type="string" name="name">docs</param>
      </operation>
      <operation id="Blob.Get">
        <param type="string" name="xpath">file:content</param>
      </operation>
      <operation id="Blob.CreateZip">
        <param type="string" name="filename">reunion.zip</param>
      </operation>
      <operation id="Context.SetInputAsVar">
        <param type="string" name="name">zip</param>
      </operation>
      <operation id="Document.Pop"/>
      <operation id="Notification.SendMail">
        <param type="string" name="from">expr:CurrentUser.email</param>
        <param type="string" name="message">template:mail_listing_body</param>
        <param type="string" name="subject">Reunion</param>
        <param type="stringlist" name="to">expr:Context["mail_to_read"]</param>
        <param type="boolean" name="HTML">true</param>
        <param type="string" name="viewId">view_documents</param>
      </operation>
      <operation id="Document.Create">
        <param type="string" name="type">File</param>
        <param type="string" name="name">zip</param>
        <param type="properties" name="properties">dc:title=zip</param>
      </operation>
      <operation id="Blob.Set">
        <param type="blob" name="file">expr:Context["zip"]</param>
        <param type="boolean" name="save">true</param>
        <param type="string" name="xpath">file:content</param>
      </operation>
      <operation id="Document.Save"/>
      <operation id="Seam.AddInfoMessage">
        <param type="string" name="message">expr:Context["liste_exterieurs"]</param>
      </operation>
      <operation id="Notification.SendMail">
        <param type="string" name="from">nuxeo</param>
        <param type="string" name="message">xxx</param>
        <param type="string" name="subject">xxx</param>
        <param type="stringlist" name="to">expr:Context["liste_exterieurs"]</param>
        <param type="boolean" name="HTML">false</param>
        <param type="stringlist" name="files">file:content</param>
        <param type="string" name="viewId">view_documents</param>
      </operation>
      <operation id="Document.Delete"/>
    </chain>
10/11/2012