1

I've been following Sprigg's helpful lookup documentation and I can pull the right fields that I need into the email. Here is the code:

%%[ var @FromName, @lookupValue 
set @lookupValue = AttributeValue("Lookup") /* value from attribute or DE column in send context */
set @FromName = Lookup("DEname","ColumnName","Lookup", @lookupValue) ]%%

%%=v(@FromName)=%%

I'm using this to get the variable for use within the sender profile which I populate with:

%%=ContentBlockbyKey("Keyname")=%%

I then build my email with the code snippet block inserted into my email.

My issues stem from the fact that my preview and testing is very inconsistent. Sometimes I receive the email with the right FromName and EmailName. Other times it defaults to the default sender information and other times I don't get an email at all.

I'm using two blocks to give my both my FromName and FromEmail variables and after attempting to get it right for a week, I don't know where I'm going wrong.

My hope is to get this going and then try to figure out how to also create a 3rd variable for dynamic reply to email.

Being new to AMPscript it's hard to pinpoint where I'm going wrong and if what I'm trying to achieve is possible.

Any insight?

2

Emails are processed from the top down, starting with the From Name and From Email. Meaning the Sender Profile is processed before the email content, so they aren't returning any values and end up using your default setting or causing an error. To use a lookup value you need to call the ContentBlock and variable inside the sender profile field.

Add something like this in the field for From Name:

 %%[ ContentBlockbyKey("Keyname") ]%% %%=v(@Keyname)=%%

Same process will work for From Email, Reply Name, and Reply Address. Hope this works for you.

  • Thank you Kyle, that was a new approach for me, but unfortunately I'm still pulling the default in the test sends. Is there best approach for what type of content block that should be used and where it should be placed in the email? Maybe I'm doing something wrong there. – Heavy2 Mar 28 at 4:43
  • Are the From Name and From Email values available in the data extension you're sending to? If they are, you can simply call them in the sender profile with %%FromName%% and %%FromEmail%% (making sure to use the exact field names that's in your data extension). – Kyle Szabo Mar 28 at 5:01
  • Kyle, wish my invisible votes were worth more. What you suggested totally worked, I just initially placed the wrong variable in the code you provided. Thank you! I spent at least 6 hours on this over the past week. – Heavy2 Mar 28 at 6:21
  • Great! I’m glad I was able to help. If my answer solved your problem, check it as the correct answer to help others in the same situation. Thank you! – Kyle Szabo Mar 28 at 11:50

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.