Create a Send Classification

Why Create a Send Classification 

You can use a send classification to specify the sender profile, delivery profile, and CAN-SPAM classification for an email message you send via the SOAP API. This includes the From information, physical address, and other information required before an email can be sent.

How to Create a Send Classification 

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

You must create both a sender profile and a delivery profile and know the external keys for both before executing the sample code below. If you don’t know the external keys for the sender profile and the delivery profiles, perform a Retrieve call to get that information and include it in the sample code below.

Sample .NET Code 

1public static void CreateSendClassification() {
2    SoapClient partnerApi = new SoapClient();
3    partnerApi.ClientCredentials.UserName.UserName = "username";
4    partnerApi.ClientCredentials.UserName.Password = "password";
5    string requestID = string.Empty;
6    string status = string.Empty;
7    //instantiate the SendClassification and set the general properties
8    SendClassification sc = new SendClassification();
9    sc.Name = "API Send Class";
10    sc.Description = "Created through API";
11    sc.CustomerKey = "API_SEND_CLASS";
12
13    //set the classification type (default = Marketing/Commercial)
14    //Marketing = Commercial
15    //Operational = Transactional
16    sc.SendClassificationType = SendClassificationTypeEnum.Marketing;
17    sc.SendClassificationTypeSpecified = true;
18
19    //set the sender profile
20    SenderProfile sp = new SenderProfile();
21    sp.CustomerKey = "12345";
22    sc.SenderProfile = sp;
23    //set the delivery profile
24    DeliveryProfile dp = new DeliveryProfile();
25    dp.CustomerKey = "1234";
26    sc.DeliveryProfile = dp;
27    //Optional - honor opt outs for transactions/operational sends (default = false)
28    //sc.HonorPublicationListOptOutsForTransactionalSends = true;
29    //sc.HonorPublicationListOptOutsForTransactionalSendsSpecified = true;
30    //create the send classification
31    CreateResult[] results = partnerApi.Create(null, new APIObject[] { sc }, out requestID, out status);
32    //parse the results for objectID or error
33    if (status.ToUpper() == "OK") {
34        Console.WriteLine("Send Classification Created");
35        Console.WriteLine("SendClassificationID: " + results[0].NewObjectID);
36    } else {
37        Console.WriteLine("Send Classification Create Failed");
38        Console.WriteLine(results[0].StatusMessage);
39    }
40}

See Also