Strip email domain from email address with Velocity | Community
Skip to main content
May 10, 2017
Solved

Strip email domain from email address with Velocity

  • May 10, 2017
  • 2 replies
  • 1981 views

Hi all - I'm looking to strip the email domain from a record's email address as a placeholder for Company Name. I figure I can do this with an email script token, but I'm having some trouble finding any examples to work off of. Any ideas?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Josh doesn't like Velocity today.

#set( $domainMatcher = $lead.Email.split("^.*@") )

#if( !$lead.Company.isEmpty() )

Real Company field: ${lead.Company}

#elseif( $domainMatcher.size() > 1 )

Synthetic Company from Email: $domainMatcher[1]

#else

No Company available.

#end

This'll get you what you're describing -- just realize that if someone uses a personal email address their employer isn't "gmail.com."

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 11, 2017

Josh doesn't like Velocity today.

#set( $domainMatcher = $lead.Email.split("^.*@") )

#if( !$lead.Company.isEmpty() )

Real Company field: ${lead.Company}

#elseif( $domainMatcher.size() > 1 )

Synthetic Company from Email: $domainMatcher[1]

#else

No Company available.

#end

This'll get you what you're describing -- just realize that if someone uses a personal email address their employer isn't "gmail.com."

Josh_Hill13
New Participant
May 10, 2017

at the form fill level or when you send an email with a token?

Form Fill=use jquery

Token Rendering = use a process outside of marketo to parse this when Company IS EMPTY.