Analyse email about its domain using velocity
Hi everyone,
I like to check the email address for specific domains using velocity/email scripting. But for some reasons it is not working for me.
Attempt 1 - Using contains
#set($mail = "wolfram.lotz@xy-c.com")
$mail.contains("xy-c.com")
this works fine
#set($mail= "{{lead.Email Address}}")
$mail.contains("xy-c.com")
$mail
contains is always false
but $mail output shows the correct domain
Attempt 1 - Using split (to check later for equal)
#set($mail = "wolfram.lotz@xy-c.com")
#set($domain= $mail.split("@"))
$domain[1]
This works fine. Domain is shown correct.
#set($mail = "{{lead.Email Address:default=edit me}}")
#set($address= $mail.split("@"))
$address[0]
This split does not work. It shows the whole email instead of just the part before the @
Note: I'm checking this within the email, which is why you see ":default=edit me" here.
I checked as well the following post: https://nation.marketo.com/t5/product-discussions/velocity-splitting-a-string-into-an-array/td-p/144641
#set ($string = "ABCD/GIST/SPIT")
#set ($output = $string.split('/'))
$output[0]
That code is working totally fine as well. But even trying to use a unicode u0040 instead of the @-char does not change anything.
Does anybody have an idea?