0

I'm trying to set up a dynamic sender profile but something is wrong.

I've followed this solution step by step: Sender Profile AMPscript

But it doesn't work. Problem seems to be the from address, since the sender profile does not appear in the preview and test drop down list any longer as soon as I set a dynamic from address. If I set it static, with a verified address, and use the dynamic block for the from name only, the sender profile appears in the dropdown list again, but the email fails to arrive.

I've created a very simple dynamic block:

%%[ 

var @fromName 
var @fromAddress

set @a = 1
set @b = 2

if a == 1 then
 set fromName = "From Name 1"
 set @fromAddress = "firstEmail@email.com"
else
 set fromName = "From Name 2"
 set @fromAddress = "secondEmail@email.com"

ENDIF

]%%

I changed the email addresses for privacy purposes, but the ones I am using are correctly verified. And then added ampscript to my sender info fields:

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

I can't see any error in the code. Is there anything I am missing?

Any help would be much appreciated.

Thanks

2
  • There is an error in your If statement, it should be if @a == 1. Also in the set statments – Swati Mishra Nov 11 '20 at 9:29
  • True, but still not working. – robruf Nov 11 '20 at 9:46
0

First of all, Make sure this feature is enabled in your account Your code has syntax issues.

 %%[
var @fromName 
var @fromAddress

set @a = 1
set @b = 2

if @a == 1 then
 set @fromName = "From Name 1"
 set @fromAddress = "firstEmail@email.com"
else
 set @fromName = "From Name 2"
 set @fromAddress = "secondEmail@email.com"

ENDIF

]%%
%%=v(@fromAddress)=%%

And then used %%=ContentBlockbyId("ContentID")=%% in the from email under sender profile.

9
  • True, but still having the same problem. – robruf Nov 11 '20 at 9:45
  • Updated Answer above – Swati Mishra Nov 11 '20 at 9:54
  • Ok, I am seeing the sender profile in the dropdown list now, but when I send the email, it never gets delivered. This is what is shown in the tracking: ibb.co/HVgFY5Q – robruf Nov 11 '20 at 10:01
  • Try to test your code snippet in an email to see whether you get an ampscript error – Swati Mishra Nov 11 '20 at 10:03
  • Code works fine, no errors. The variable is shown correctly... – robruf Nov 11 '20 at 10:49

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.