I would like to apply some dynamic logic to a triggered send Sender Profile. I believe below information should help in producing. Can anyone assist?

Entry DE is 'Entry_DE'
_subscriberkey is found in above DE, column named ‘SubscriberKey’
Looking up corresponding attribute under column named ‘Brand’
If Brand = ‘Apple’ then From Name is ‘Apple’ and From Email is ‘apple@mail.com’
If Brand = ‘Banana’ then From Name is ‘Banana’ and From Email is ‘banana@mail.com’

There are a couple of different approaches to this, which have been answered previously. However, the approach will vary depending on how your data is stored.

Previous answers refer to retrieving these values from a separate DE (other than your sendable/entry DE), which is not what you want — it appears that the values used for conditional evaluation will appear in your sendable/entry DE.

The easiest method would be to include the AMPscript block in a Content Block and invoke the Content Block, as maintaing code in the Sender Information form fields is fairly awkward.

Here's how I would approach this.

1. Create a Content Block

In Content Builder, create a Content Block with an 'HTML' type (this is important, as even though you are not using this in your email, other blocks are wrapped in tables).

In your Content Block, add the following code:

var @fromName, @fromEmail

if AttributeValue('Brand') == 'Apple' then
   set @fromName = 'Apple'
   set @fromEmail = 'apple@mail.com'
elseif AttributeValue('Brand') == 'Banana' then
   set @fromName = 'Banana'
   set @fromEmail = 'apple@mail.com'
else /* fallback if neither evaluates to true */
   set @fromName = 'Pear'
   set @fromEmail = 'pear@mail.com'

Next I would recommend defining a Customer Key when you save the Sender Profile (which is easier to reference than defining the absolute path name to the Content Block). Enter a value like sender-profile as your Customer Key value.

2. Add AMPscript to your Sender Information fields

In Email Studio, go to Admin > Sender Profiles and open the sender profile that you are using to send your email (or create a new one).

Then under Sender Information, select the 'Use the specified information' option and enter the following values in the fields:

From Name:


From Email:


If you used a value other than sender-profile as your Customer Key value in the previous step, then you should update this here.

That's all that's required!

| improve this answer | |
  • Hi Eliot, when I try to put your From Email code into my sender profile, I get an error: "Domain Verification Error", with "ID: -1" and "Message: Please enter a valid email address". Any idea what's going on with that error? Thanks – Ben May 21 at 1:13
  • The email addresses need to either use the Sender Authentication Package domain or be added to the 'From Address Management' page in Setup. – Eliot Harper May 21 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.