<?php require '../ET_Client.php'; try { $myclient = new ET_Client(); $NewSendDefinitionName = "PHPSDKSendDefinition"; $SendableDataExtensionCustomerKey = "F6F3871A-D124-499B-BBF5-3EFC0E827A51"; $EmailIDForSendDefinition = "3113962"; $ListIDForSendDefinition = "1729515"; $SendClassificationCustomerKey = "2239"; print "Retrieve Send Definition Details \n"; $getSendDefinition = new ET_Email_SendDefinition(); $getSendDefinition->authStub = $myclient; $getSendDefinition->props = array('Client.ID', 'CreatedDate', 'ModifiedDate', 'ObjectID', 'CustomerKey', 'Name', 'CategoryID', 'Description', 'SendClassification.CustomerKey', 'SenderProfile.CustomerKey', 'SenderProfile.FromName', 'SenderProfile.FromAddress', 'DeliveryProfile.CustomerKey', 'DeliveryProfile.SourceAddressType', 'DeliveryProfile.PrivateIP', 'DeliveryProfile.DomainType', 'DeliveryProfile.PrivateDomain', 'DeliveryProfile.HeaderSalutationSource', 'DeliveryProfile.FooterSalutationSource', 'SuppressTracking', 'IsSendLogging', 'Email.ID', 'BccEmail', 'AutoBccEmail', 'TestEmailAddr', 'EmailSubject', 'DynamicEmailSubject', 'IsMultipart', 'IsWrapped', 'SendLimit', 'SendWindowOpen', 'SendWindowClose', 'DeduplicateByEmail', 'ExclusionFilter', 'Additional'); $getResponse = $getSendDefinition->get(); print_r('Get Status: ' . ($getResponse->status ? 'true' : 'false') . "\n"); print 'Code: ' . $getResponse->code . "\n"; print 'Message: ' . $getResponse->message . "\n"; print_r('More Results: ' . ($getResponse->moreResults ? 'true' : 'false') . "\n"); print 'Results Length: ' . count($getResponse->results) . "\n"; print "\n---------------\n"; print "Create SendDefinition to DataExtension \n"; $postSendDefinition = new ET_Email_SendDefinition(); $postSendDefinition->authStub = $myclient; $postSendDefinition->props = array("Name" => $NewSendDefinitionName); $postSendDefinition->props["CustomerKey"] = $NewSendDefinitionName; $postSendDefinition->props["Description"] = "Created with PHPSDK"; $postSendDefinition->props["SendClassification"] = array("CustomerKey" => $SendClassificationCustomerKey); $postSendDefinition->props["SendDefinitionList"] = array("CustomerKey" => $SendableDataExtensionCustomerKey, "DataSourceTypeID" => "CustomObject"); $postSendDefinition->props["Email"] = array("ID" => $EmailIDForSendDefinition); $postResult = $postSendDefinition->post();
public function getSendDefinitions() { $sd = new \ET_Email_SendDefinition(); $sd->authStub = $this->fuel; $sd->props = array('Name', 'Client.ID', 'CustomerKey', 'Description', 'Email.ID', 'CategoryID', 'SendDefinitionList', 'SenderProfile.CustomerKey'); $getRes = $sd->get(); if ($getRes->status == true) { return $getRes; } else { Log::error('Error retrieving (getSendDefinition)', [$getRes]); return false; } }