cancel
Showing results for 
Search instead for 
Did you mean: 

Sending packageItems as an email attachment

ramymansouri
Champ in-the-making
Champ in-the-making
Good morning,

Please, is there any solution for sending packageItems by email at the end of the workflow task ?

Thanks.
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
You could surely do that using alfrescojavascript in workflow process definition file


or

in Workflow action class
http://blog.arvixe.com/alfresco-jbpm-workflow-action-class/
http://blog.arvixe.com/create-listener-class-in-activiti-workflow-of-alfresco/

Thank you mitpatoliya for you quick answer,
I've already created my CustomReview implement TaskListener and I can send email but without attachments because MailActionExecuter doesn't support attachments, and I didn't find a clue for that.

I understand you want to send an email with attachment and using MailActionExecuter you are not able to do it.
One alternative to do it would be as follow -
1. Create a bean say MailBean. Inject JavaMailSender to it the way it has been done in MailActionExecuter.
2. Create a method which will take parameters from, to, cc, bcc, subject, bodyText and File.
3. Now, create MimeMessage and MimeMessageHelper instances.
4. Use MimeMessageHeper's addAttachment() method to add an attachment and then send the message.
5. You can get the MailBean in your task listener by loading it from the spring context.

Hope this helps.

ramymansouri
Champ in-the-making
Champ in-the-making
Thank you so much for your response romschn , I'll try it right now ! Hope getting a good result Smiley Happy)