I'm trying to send a triggered send as is explained here: https://code.exacttarget.com/apis-sdks/fuel-sdks/triggered-sends/triggered-send-send.html#phpsend
I'm trying to display content from the web service in the email via AMPscript as is explained here: http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/using_ampscript_with_the_web_service_api/passing_content_to_a_triggered_send_message_at_send_time/
It's not working though. How do I access the attribute values from the triggered send web service in the actual email within the AMPscript? Here is my web service call:
require('ET_Client.php');
$myclient = new ET_Client();
$triggeredsend = new ET_TriggeredSend();
$triggeredsend->authStub = $myclient;
$triggeredsend->props = array('CustomerKey' => $customerkey);
$triggeredsend->subscribers = array(array(
'EmailAddress' => $email,
'SubscriberKey' => $email,
'Attributes' => array('Name' => 'maxTransport', 'Value' => $maxTransport)
));
$results = $triggeredsend->send();
And here is how I'm trying to display the variable in my email:
Max Transport = %%maxTransport%%
But the variable is not showing up, and I get a validation error for my email that says:
Errors found in the email HTML Body. Category : Substitution String
Personalization error:%%maxtransport%% To fix the problem, please try
the following: Make sure that there is not a space or typo within the
personalization string in your email. For example, check and correct
any spaces between percent signs (%%)
Best Answer
Welcome to SFSE!
Do you have a
maxTransport
column in the target Data Extension configured in your Triggered Send Definition? If not, you'll need one.It's a good practice to wrap personalization strings with the AttributeValue() function in your email. Make sure to include the double-quotes around the attribute name. For example:
If you use the
AttributeValue()
function, you can check if it's undefined or empty using theempty()
function, e.g: