Hi Courtney - yeah, that's what our security team mentioned as well. For example, if we have a campaign where we want to include a "first.last@marketing.avanade.com", the Exchange team can add this additional email/sub-domain to the user's record (or like you said, even a rule for all users)
The issue here is - when we're dynamically pulling in account owner email addresses - using the "account.owner email" token - the actual FROM/REPLY-TO addresses will contain the actual email address, not the address with the sub-domain.
Oh! Easy enough:
#set( $email = ${lead.Sales Owner Email Address} )
#set( $domain = "marketing.demandlab.com" )
#set( $final = $email.replace("demandlab.com", ${domain}) )
${final}
Wow, thanks Courtney - that was easy! Brings back memories of my ASP/vbscript days. I definitely need to do more with velocity in Marketo.
I have this working using the following script:
#set( $email = ${lead.Avanade_BD_Owner_EmailAddress} )
#set( $domain = "@marketing.avanade.com" )
#set( $final = $email.replace("@avanade.com", ${domain}) )
${final}
Except when there is no value for "Avanade Sales BD EmailAddress". It doesn't appear velocity script tokens use the DEFAULT value for when there is a NULL value:
{{my.Transformed BD Email Address:default=info@marketing.avanade.com}}
What other approach can I use to use a fallback value when the value is NULL/empty?
With Velocity, you output the default from the token itself, e.g.
#set( $defaultEmail = "info@marketing.avanade.com" )
#set( $email = ${lead.Avanade_BD_Owner_EmailAddress} )
#set( $domain = "@marketing.avanade.com" )
#set( $final = $email.replace("@avanade.com", ${domain}) )
#if( $final.isEmpty() )
#set( $final = $defaultEmail )
#end
${final}
Perfect - thanks Sandy!