Clarity: Process kicks off and finishes successful, however no emails are sent when GEL script ran.

Document ID : KB000022905
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Process kicks off and finishes successful, however no emails are sent when GEL scipt ran.

Error in nikubg-system.log:
[...]
Exception in thread "Thread-XXX" java.lang.NullPointerException
at javax.mail.internet.InternetAddress.lengthOfFirstSegment
[..]

If "to" parameter in the GEL script includes twice or more the same email address, either due to some resources have the same email address or GEL contains a dynamic parameter repeats the email.

example 1:
TO: user@domain.com;user@domain.com

example 2:
<gel:email from="${sender}" to="${ToUser1} ${ToUser3} ${ToUser4} ${ToUser5} ${ToUser6}"....

The email is never sent and there is an java error in the logs.

Steps to Reproduce:

  1. Create a process.

  2. Create a step with includes a GEL script.

  3. GEL script sends an email with several recipients, there is at lease 1 email repeated.

Expected Result: Email sent to all recipients.
Actual Result: Email is never sent and there is an java error in the logs.

Solution:

The problem is in com.niku.union.gel.tags.EmailTag. When the address array is built it includes a null entry.

Use jelly:email tags instead.

Example:


<gel:script 
xmlns:core="jelly:core" 
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" 
xmlns:mail="jelly:email"> 
 
<mail:email 
from="admin@test.com" 
to="user1@test.com;user1@test.com;user1@test.com;user2@test.com" 
subject="Simple email" 
server="mail.ca.com"> 
Hello World. 
</mail:email> 
</gel:script>