2

What I have is multiple email templates that are associated with different organizations and artists in one ExactTarget account. I want to be able to set an AMPscript or SSJS variable that would be read by a custom sender profile and change the from name depending on which template I was using.

So for example, at 10:00 I send an email for Company A using their own custom template and the from name is "Company A". In the SAME ET ACCOUNT I send one later using the SAME SENDER PROFILE for Company B using their custom template, and the from name appears as "Company B"

I've tried simply setting variables in the template, but the sender profile is evaluated first so it doesn't pick up on any AMPscript declarations made in the content. As a long shot I also tried upserting to a Data Extension for each job and setting 2 columns JobID and From_Name. JobID was set automatically by the current JobID associated with the send, and "From_Name" was set by me in the template. As expected this didn't work either.

I've done a little server side javascript, but not much and don't know if this is viable. Any help appreciated!

* Update 3/6/2014 *

I turned on the "ENHANCED_SENDER_PROFILE" business rule and it still doeesn't appear to be working.

Below is my AMPscript:

Sender Profile:

%%[ 
VAR @Dynamic_From_Name_Output 

IF Empty(@Dynamic_From_Name) THEN    
  SET @Dynamic_From_Name_Output = 'Default From Name' 
ELSE   
  SET @Dynamic_From_Name_Output = @Dynamic_From_Name 
ENDIF  
]%% 

%%=v(@Dynamic_From_Name_Output)=%%

And this is what is in my email:

%%[
VAR @Dynamic_From_Name
SET @Dynamic_From_Name = 'Dynamic From Name'
]%%

Am I missing something obvious?

  • I'm fairly certain this is doable, but I'll need to dig up some code. – Kelly J Andrews Mar 6 '14 at 0:23
1

After attempting this on my own and working with the Salesforce Marketing Cloud Premium Support team - it was concluded that using the v() ampscript function is not possible to use in a SenderProfile given how the ampscript is compiled at time of send.

One working solution is to use the TreatAsContent(ContentArea()) functions to pull in dynamic content for From Name and From Email in a sender profile.

  • So I set the values in my template like this: %%[ SET @Dynamic_From_Name = "Jo Shmo" ]%%. Then I set the Stored content Area with a value of this %%=v(@Dynamic_From_Name)=%%. Lastly I put the following AMPscript in the sender profile %%=TreatAsContent(ContentArea(17222291))=%%. This didn't work, but I figured I'm doing something wrong. Any Ideas? – DigitalMC Jan 6 '15 at 22:36
  • It should work if you SET @Dynamic_From_Name within the ContentArea, not the template. Also make sure you define the variable using VAR. :) Right now, from the ContentArea's perspective, you're trying to use a variable that is not defined. – Daniel Jan 8 '15 at 17:38
  • Ha, thanks for the correction. Well if I set the variable in the content area, how will it be dynamic? So for example I'm building an email for "Brand A". I use the "Brand A" template and fill it with content. Now there is no way for me to change the stored content dynamically area to have "Brand A" reflected in the From Name. – DigitalMC Jan 8 '15 at 20:51
  • 2
    You need an identifying attribute to determine CompanyA vs. CompanyB. Take "ClientID" for example. If every list you send from has a ClientID then you can accomplish this using a Content Area. For example: %%[ VAR @Dynamic_From_Name IF ClientID == 00001 THEN SET @Dynamic_From_Name = "Company A" ELSEIF ClientID == 00002 THEN SET @Dynamic_From_Name = "Company B" ELSE SET @Dynamic_From_Name = 'Default' ENDIF ]%%%%=v(@Dynamic_From_Name)=%% If you're looking to define the FromName within the email template manually, this cannot be used in a Sender Profile, even when using a ContentArea. – Daniel Jan 15 '15 at 23:20
  • 1
    For more information on the IndexOf() function: help.exacttarget.com/en/documentation/exacttarget/content/… Personalization strings: help.exacttarget.com/en/documentation/exacttarget/content/… – Daniel Jan 18 '15 at 23:32
3

It is possible to implement dynamic from name and address using AMP Script expressions. You'll need to contact support/account manager to enable ENHANCED_SENDER_PROFILE business rule and then using expressions like

%%=v(@fromName)=%% 

and

%%=v(@fromEmail)=%% 

in From Name and From Email configure "dynamic" sender profile. And finally last step would be to setup the @fromName and @fromEmail variables in the content of the email.

I have few implementations where from name and address were included into data extension on the record level (e.g. each subscriber record included from name and address fields) and we've used that approach successfully.

  • I can't comment on the top question, but in your AMP Script you check whether or not @RR_Dynamic_From_Name is empty, while further in the code you actually set @Dynamic_From_Name variable. Is that really so or is it a typo here? – Vlad Mar 7 '14 at 3:44
  • Good catch. It changed my variable names for clarity in this post and missed that one. I've updated the code and still not working properly. I still get 'Default From Name' coming through. – DigitalMC Mar 7 '14 at 16:47
  • Okay, I might be guessing a bit here. But just re-reading your post you have quite a piece of code in the actual Sender Profile. Can you just try using %%=v(@Dynamic_From_Name_Output)=%% in the From Name field and then move the entire setup and logic into email. Basically make it simple for the profile - just output the variable and encapsulate your decisions in the email. Let us know if that will make any difference. – Vlad Mar 9 '14 at 12:40
  • I am used this solution but I cannot get it to work either. It still deploys the email using the default sender profile – BDOB83 Mar 6 '16 at 6:15
  • I managed to get it to work - in the from name do not use %%=v(@Dynamic_From_Name_Output)=%% just use %%myemailfield%%. However the field has to be the exact same name as the DE it is loading in from. – BDOB83 Mar 6 '16 at 7:04
1

All the code needs to go in the from name and address field in the sender profile.

The look up code and %%=v()=%% expression all need to be placed within name|address field.

%%[ 
VAR @Dynamic_From_Name_Output 

IF Empty(@Dynamic_From_Name) THEN    
SET @Dynamic_From_Name_Output = 'Default From Name' 
ELSE   
SET @Dynamic_From_Name_Output = @Dynamic_From_Name 
ENDIF  
]%% 

%%=v(@Dynamic_From_Name_Output)=%%

Strip out the CRLFs and place the following in the name|address Sender Profile fields

%%[ VAR @Dynamic_From_Name_Output IF Empty(@Dynamic_From_Name) THEN   SET @Dynamic_From_Name_Output = 'Default From Name' ELSE   SET @Dynamic_From_Name_Output = @Dynamic_From_Name ENDIF ]%% %%=v(@Dynamic_From_Name_Output)=%%

The above approach worked for me.

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.