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 ‘[email protected]’
If Brand = ‘Banana’ then From Name is ‘Banana’ and From Email is ‘[email protected]

2 Answers 2


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 maintaining 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 'Code Snippet' 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 = '[email protected]'
elseif AttributeValue('Brand') == 'Banana' then
   set @fromName = 'Banana'
   set @fromEmail = '[email protected]'
else /* fallback if neither evaluates to true */
   set @fromName = 'Pear'
   set @fromEmail = '[email protected]'

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!

  • 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
    Commented May 21, 2020 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. Commented May 21, 2020 at 1:35

You are missing a space in between "%%%%", without the space it did not work for me.

Should be:

From Name:

%%[ContentBlockByKey("sender-profile")]%% %%=v(@fromName)=%%

From Email:

%%[ContentBlockByKey("sender-profile")]%% %%=v(@fromEmail)=%%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .