Schedule an Email Send Definition

This page contains information about scheduling an email send definition.

Why Schedule an Email Send Definition 

By scheduling an email send definition, you can select the precise time you want the email send to go out. Note that this call schedules the time to begin the send and not when subscribers actually receive the email in their inbox.

How to Schedule an Email Send Definition 

Use the sample code below as a model for your own API call.

Sample .NET Code 

public void testSchedule()
    {
        ScheduleDefinition sd = new ScheduleDefinition();
        sd.RecurrenceType = RecurrenceTypeEnum.Daily;
        sd.RecurrenceTypeSpecified = true;
        sd.RecurrenceRangeType = RecurrenceRangeTypeEnum.EndAfter;
        sd.RecurrenceRangeTypeSpecified = true;
        sd.Occurrences = 1;
        sd.OccurrencesSpecified = true;
        DateTime time = new DateTime(2010,03,16,14,32,00,DateTimeKind.Utc);
        sd.StartDateTime = time;
        sd.StartDateTimeSpecified = true;
        DailyRecurrence dr = new DailyRecurrence();
        dr.DailyRecurrencePatternType = DailyRecurrencePatternTypeEnum.Interval;
        dr.DailyRecurrencePatternTypeSpecified = true;
        dr.DayInterval = 1;
        dr.DayIntervalSpecified = true;
        sd.Recurrence = dr;
        String o1;
        String o2;
        String r;
        EmailSendDefinition definition = new EmailSendDefinition();
        definition.CustomerKey = "CustomerKeyValue";
        ScheduleResult[] s =
            soapClient.Schedule(new ScheduleOptions(), "start", sd, new APIObject[] {definition}, out o1, out o2,
                                out r);
        Console.Write("Done");
    }

SOAP Request 

<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ScheduleRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Action>start</Action>
        <Schedule>
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <Recurrence xsi:type="q1:DailyRecurrence" xmlns:q1="http://exacttarget.com/wsdl/partnerAPI">
                <q1:DailyRecurrencePatternType>Interval</q1:DailyRecurrencePatternType>
                <q1:DayInterval>1</q1:DayInterval>
            </Recurrence>
            <RecurrenceType>Daily</RecurrenceType>
            <RecurrenceRangeType>EndAfter</RecurrenceRangeType>
            <StartDateTime>2010-05-16T14:32:00-04:00</StartDateTime>
            <Occurrences>1</Occurrences>
        </Schedule>
        <Interactions>
            <Interaction xsi:type="q2:EmailSendDefinition" xmlns:q2="http://exacttarget.com/wsdl/partnerAPI">
                <q2:PartnerKey xsi:nil="true"/>
                <q2:ObjectID xsi:nil="true"/>
                <q2:CustomerKey>CustomerKeyValue</q2:CustomerKey>
            </Interaction>
        </Interactions>
    </ScheduleRequestMsg>
</s:Body>

SOAP Response 

<soap:Body>
    <ScheduleResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Results>
            <Result>
                <StatusCode>OK</StatusCode>
                <StatusMessage>EmailSendDefinition scheduled</StatusMessage>
                <Object>
                    <PartnerKey xsi:nil="true"/>
                    <ObjectID xsi:nil="true"/>
                    <Recurrence xsi:type="DailyRecurrence">
                        <DailyRecurrencePatternType>Interval</DailyRecurrencePatternType>
                        <DayInterval>1</DayInterval>
                    </Recurrence>
                    <RecurrenceType>Daily</RecurrenceType>
                    <RecurrenceRangeType>EndAfter</RecurrenceRangeType>
                    <StartDateTime>2010-05-16T12:32:00-06:00</StartDateTime>
                    <Occurrences>1</Occurrences>
                </Object>
                <Task>
                    <StatusCode>OK</StatusCode>
                    <StatusMessage>OK</StatusMessage>
                    <ID>12808147</ID>
                </Task>
            </Result>
        </Results>
        <OverallStatus>OK</OverallStatus>
        <OverallStatusMessage/>
        <RequestID>009cb04e-93be-48e8-871c-c658487634b4</RequestID>
    </ScheduleResponseMsg>
    <par:ScheduleRequestMsg xmlns:par="http://exacttarget.com/wsdl/partnerAPI"/>
</soap:Body>