I'm trying to create a scheduled send definition and I receive the following exception: [StatusMessage] => Exception occurred during [ScheduleEmailSendDefinition] ErrorID: 540318960

This is the code I'm using:

    $schr = new ExactTarget_ScheduleRequestMsg();
    $schr->Action = "start";
    $schr->Interactions = array();

    $sendtime = new DateTime($send_datetime);

    $etr = new ExactTarget_DailyRecurrence();
    $etr->DailyRecurrencePatternType = ExactTarget_DailyRecurrencePatternTypeEnum::Interval;
    $etr->DayInterval = 1;

    $sd = new ExactTarget_ScheduleDefinition(); 
    $sd->RecurrenceType = ExactTarget_RecurrenceTypeEnum::Daily;
    $sd->RecurrenceRangeType = ExactTarget_RecurrenceRangeTypeEnum::EndAfter;
    $sd->StartDateTime = $sendtime->format("c");
    $sd->Occurrences = 1;
    $sd->Recurrence = new SoapVar($etr, SOAP_ENC_OBJECT, 'DailyRecurrence', $this->api_url); 

    $schr->Schedule = $sd;

    $group = new ExactTarget_Group();
    $group->ID = $group_id;

    $senddeflist = new ExactTarget_SendDefinitionList();
    $senddeflist->DataSourceTypeID = "List";
    $senddeflist->List = $group;

    $email = new ExactTarget_Email();
    $email->ID = $email_id;

    $sendclass = new ExactTarget_SendClassification();
    $sendclass->CustomerKey = $customerKey;

    $esd = new ExactTarget_EmailSendDefinition();
    $esd->SendDefinitionList = $senddeflist;
    $esd->Email = $email;
    $esd->Name = $name;
    $esd->SendClassification = $sendclass;
    $esd->CustomerKey = $esd_CustomerKey;

    $schr->Interactions[] = new SoapVar($esd, SOAP_ENC_OBJECT, 'EmailSendDefinition', $this->api_url);
    $schr->Options = NULL;

    $results = $this->exacttargetsoapclient->Schedule($schr);

I don't believe it is possible to create an adhoc EmailSendDefinitions when calling Schedule. The EmailSendDefinition will need to exist in the account prior to calling Schedule.

The error code corresponds to the error "EmailSendDefinition does not exist".

  • Thank you, I modified the code to create the EmailSendDefinition first, and then schedule definition and it worked
    – Fede R.
    Feb 5 '14 at 12:59

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.