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:

$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 (%%)


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:


var @maxTransport
set @maxTransport = AttributeValue("maxTransport")

<br>maxTransport: %%=v(@maxTransport)=%%

If you use the AttributeValue() function, you can check if it's undefined or empty using the empty() function, e.g:


if not empty (@maxTransport) then 
  outputLine(concat("maxTransport: ",@maxTransport))
  outputLine(concat("maxTransport is empty"))

  • So I can't just send a value from the PHP code and consume it in the AMPscript - I have to create a Data Extension in addition? If so, I'm wondering why that's not mentioned here: help.exacttarget.com/en/documentation/exacttarget/content/… – Industrial Themes Nov 24 '15 at 19:45
  • By the way, meant to say thanks for the welcome and thanks for the quick response! – Industrial Themes Nov 24 '15 at 20:25
  • Aha - I tested it and it is working! The missing piece for me was the AttributeValue() function wrapper. Thanks for your answer! – Industrial Themes Nov 24 '15 at 21:20
  • ::fist bump:: It's a good practice to configure your Triggered Send Definitions to write to a Data Extension -- just in case you need to verify data or run send previews. You can also use the DE in suppression scripts, etc. The DEs must be created with a template: help.exacttarget.com/en-US/documentation/exacttarget/… – Adam Spriggs Nov 24 '15 at 22:16

For others, I thought I'd post my answer to a similar question on how to do this specifically with ExactTarget and PHP: https://salesforce.stackexchange.com/a/163609/71196

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.