Send attachments with mail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2011 06:07 AM
Is it possible to send attachments to mail using <input type="file"> value?
I have uploaded a file in a form using
<input type="file" name="datafile" size="40">
Now i want to send that file in mail using service task.
How to do it?
Any idea.
Thanks,
Kv
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2011 03:03 AM
If you consider using Explorer2 (will be released in distro next release), you can always use the formProperties and create a custom formProperty type with file-upload field using vaadin…
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 08:05 AM
if not how to send attachments for emails?
Is there any other way?
Thanks,
Kavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 01:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 02:10 AM
Being new to activiti can u tel me as what u mean by Commons Email?
How to add Commons Email directly? Any sample or eg?
Thanks,
kavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 02:30 AM
Since we use commons-email (apache) to send emails in activiti, you can use it, the same way as the MailActivityBehavilour does… Look at the code in org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 02:45 AM
Thanks a lot for ur reply.
Now i used Java service class as
<serviceTask completionQuantity="1" activiti:class="org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior" id="sid-1430FC68-FA04-41E0-9EDB-A9A0329F42A3" implementation="webService" isForCompensation="false" name="Email to applicant on status "OnHold"" startQuantity="1">…….
Now for this class where can i write the code?
For commons email the code is
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("mypictures/john.jpg");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Picture of John");
attachment.setName("John");
Should i write this code?If so where? if not is it enough to set field injection in extension element as
<activiti:field name="to" expression="${Email}" />
. Likewise what field is used for attachment?Thanks,
kavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 03:04 AM
Take a look at the userguide in the chapters about field injection in JavaDelegates on how to use that to configure your Javadelegate from a bpmn-process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 03:20 AM
sorry for my misunderstanding.
In that user guide they have given "declare a 'extensionElements' XML element before the actual field injection declarations". What is mean by that?
If i am using "org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior" class what should i declare? What fields should i use for attachment?
Kindly clarify as i am not able ti proceed further.
Thanks,
kavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 03:33 AM
<serviceTask id="javaService"
name="Java service invocation"
activiti:class="org.activiti.examples.bpmn.servicetask.ToUpperCaseFieldInjected">
<extensionElements>
<activiti:field name="text" stringValue="Hello World" />
</extensionElements>
</serviceTask>
The MailActivityBehaviour is actually the class that is used when using the mail-task. So when declaring a serviceTask with activiti:type=mail, this is used. So it only has the fields that are shown below, NO field for attachment:
<serviceTask id="sendMail" activiti:type="mail">
<extensionElements>
<activiti:field name="from" stringValue="order-shipping@thecompany.com" />
<activiti:field name="to" expression="${recipient}" />
<activiti:field name="subject" expression="Your order ${orderId} has been shipped" />
<activiti:field name="html">
<activiti:expression>
<![CDATA[
<html>
<body>
Hello ${male ? 'Mr.' : 'Mrs.' } ${recipientName},<br/><br/>
As of ${now}, your order has been <b>processed and shipped</b>.<br/><br/>
Kind regards,<br/>
TheCompany.
</body>
</html>
]]>
</activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>
