[SalesForce] Dynamic From Names Based On Email Content

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?

Best Answer

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.

Related Topic