1

I'm creating an email via the SOAP API. So far, this is working:

// SOAP client
@$client = new ExactTargetSoapClient($wsdl, array('trace'=>1));

// Login details
$client->username = 'xxx';
$client->password = 'xxx';

// Generate test email
$email = new ExactTarget_Email();
$email->Name = 'Test Email 1A';
$email->Subject = 'SUBJECT TBC';
$email->PreHeader = 'PREHEADER TBC';
$email->CharacterSet = 'utf-8';
$email->HTMLBody = '<p>Paragraph one</p>';
$email->EmailType = 'HTML';
$email->IsHTMLPaste = 'true';

$svEmail = new SoapVar($email, SOAP_ENC_OBJECT, 'Email', "http://exacttarget.com/wsdl/partnerAPI");

$request = new ExactTarget_CreateRequest();
$request->Options = NULL;
$request->Objects = array($svEmail);

$results = $client->Create($request);
var_dump($results);

When creating an email via the UI, there is a field at the bottom "_AdditionalEmailAttribute1". How would I adapt the above code to assign a value to this attribute for the email I'm creating?

The documentation shows ways to create a new attribute, delete an attribute, or assign an attribute to a subscriber - but I haven't found out how to set a value for an existing attribute against an email.

From looking at what's available in the API, I was thinking it might be along the following lines:

$attribute = new ExactTarget_Attribute();
$attribute->Name('_AdditionalEmailAttribute1');
$attribute->Value('150801_ABC');

$svAttribute = new SoapVar($attribute, SOAP_ENC_OBJECT, 'Attribute', "http://exacttarget.com/wsdl/partnerAPI");
$request->Objects = array($svEmail, $svAttribute);

with the last line replacing the similar line I have in the original code.

The ExactTarget_Attribute class has public properties called Name and Value, but when I attempt to use this code, I get the following error:

PHP Fatal error:  Call to undefined method ExactTarget_Attribute::Name() in exacttarget_test.php on line 40

I'm a bit cautious about experimenting with it too much, as I don't want to risk creating lots of new attributes unnecessarily.

How do you set the attribute values against an email?

1 Answer 1

0

Just as a point of clarification, Additional Email Attributes are values that are automatically appended to all links in your email. They can be static text, personalization strings or AMPScript variables. These are not Subscriber Profile Attributes.

It appears there's a single Additional attribute can be set on an EmailSendDefinition object, not the Email object.

So in the platform, you can set multiple Additional Email Attribute values when you create an email, but via API, you can only set a single attribute when creating an User-Initiated Send object.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .