We would like to send attachments in email via Gel script. We are using below code snippet but it is not working. We are able to send email notifications but the notification is failing when we include 'attach' command in the gel script.
Script
<gel:script
xmlns:core="jelly:core"
xmlns:util="jelly:util"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:mail="jelly:email" >
<gel:setDataSource dbId="niku"/>
<mail:email
from=xxxx
to=xxxx
subject="Simple email"
attach="/fs0/clarity1/share/abc/Input/XXX_CLARITY_123456.csv">
File Attach One File.
</mail:email>
</gel:script>
Error Message
BPM-0704: An error occurred while executing custom script: org.apache.commons.jelly.JellyTagException: null:4:188: <mail:email> no smtp server configured at org.apache.commons.jelly.tags.email.EmailTag.doTag(EmailTag.java:187) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:96) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:187) at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:248) at com.niku.union.gel.GELScript.run(GELScript.java:58) at com.niku.union.gel.GELController.invoke(GELController.java:79) at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:217) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
Release : 16.1
Here is an example you can customize. Replace the "from" and "to" email addresses as appropriate for your environment
<gel:script
xmlns:core="jelly:core"
xmlns:util="jelly:util"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:mail="jelly:email" >
<core:invokeStatic var="v_config" className="com.niku.union.config.ConfigurationManager" method="getInstance" />
<core:set var="mailHost" value="${v_config.getProperties().getMailServer().getHost()}" />
<gel:log>${mailHost}</gel:log>
<!-- if you are using Clarity SaaS, then the "from" email must be he same as what you usually see from email notifications, for example: "[email protected]" -->
<mail:email
from="<Clarity email here>"
to="[email protected]"
subject="Simple email"
server="${mailHost}"
attach="/fs0/clarity1/share/abc/Input/XXX_CLARITY_123456.csv">
>
Hello World.
</mail:email>
</gel:script>
This Gel sample is provided "as is". Support may not be able to assist in debugging custom GEL scripts.