Email scripting - Replace email address with x if value is y | Community
Skip to main content
May 23, 2017
Question

Email scripting - Replace email address with x if value is y

  • May 23, 2017
  • 1 reply
  • 2344 views

Hello Community!

We are looking to use email scripting for "From Address" and "reply-to" because many of our unassigned leads/contacts (unapproved accounts) have "Salesforce Admin" as the owner and tech@hired.com as the email address and we are trying to reactivate these clients via personalized emails and that will not be a good look for those clients to receive what looks to be a personal outreach email from "Salesforce Admin."

So, what we want to do is have a default From, From Address, and Reply-to for leads/contacts that have Salesforce Admin as the owner. Below I have placed so scripting that we have created thus (for email from address and reply-to) far but it is not working.

#if(${lead.Account_Owner_Email_Address}=="tech@hired.com")

#set($x_test = "kyle.cushing@hired.com,")

#else

#set($x_test = "${lead.Account_Owner_Email_Address},")

#end$

When we try to send test emails, we get nothing. What are we missing? Anything helps!! Please and thank you!!!!! @Courtney Grimes @Sanford Whiteman Support

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

1 reply

SanfordWhiteman
Level 10
May 23, 2017

Well, 2 main things:

1. You aren't outputting anything!

2. You have a breaking syntax error with that trailing $

1 minor thing:

1. Don't use ${formal.notation} unless you're inside a string. This will cause hard-to-find errors.

#if($lead.Account_Owner_Email_Address == "tech@hired.com")

#set($x_test = "kyle.cushing@hired.com,")

#else

#set($x_test = "${lead.Account_Owner_Email_Address},")

#end

${x_test}

(Also wouldn't bother @ing Support -- Velocity isn't in their domain.)