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 properties8 SendClassification sc = new SendClassification();9 sc.Name = "API Send Class";10 sc.Description = "Created through API";11 sc.CustomerKey = "API_SEND_CLASS";1213 //set the classification type (default = Marketing/Commercial)14 //Marketing = Commercial15 //Operational = Transactional16 sc.SendClassificationType = SendClassificationTypeEnum.Marketing;17 sc.SendClassificationTypeSpecified = true;1819 //set the sender profile20 SenderProfile sp = new SenderProfile();21 sp.CustomerKey = "12345";22 sc.SenderProfile = sp;23 //set the delivery profile24 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 classification31 CreateResult[] results = partnerApi.Create(null, new APIObject[] { sc }, out requestID, out status);32 //parse the results for objectID or error33 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}