Click or drag to resize

AdministrationClientSendEmailFromTemplateForCampaignWithAttachments Method

Syntax
C#
public ResultOflong SendEmailFromTemplateForCampaignWithAttachments(
	ManagementGroupRequestOfEmailSend request
)

Parameters

request
Type: AdministrationServiceManagementGroupRequestOfEmailSend

Return Value

Type: ResultOflong
Examples
C#
using (var svc = new AdministrationService.AdministrationClient())
{
  var request = new AdministrationService.ManagementGroupRequestOfEmailSend();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var emailSend = new AdministrationService.EmailSend(); //Required
  emailSend.EmailTemplateId = "Email template"; //Required
  emailSend.CampaignName = string.Empty; //Optional
  emailSend.CampaignSegmentName = string.Empty; //Optional

  var attachmentFile = new AdministrationService.EmailAttachment();
  attachmentFile.FileName = "File1.txt"; //Required
  attachmentFile.Data = new byte[1024]; //Required
  emailSend.Attachments = new AdministrationService.EmailAttachment[] { attachmentFile };//Optional

  var labelCode = new AdministrationService.MergeLabelCode();
  labelCode.LabelCode = "LC"; //Required
  labelCode.LabelCodeName = string.Empty; //Optional
  emailSend.LabelCodes = new AdministrationService.MergeLabelCode[] { labelCode };//Optional

  var logAgainstEntity = new AdministrationService.CampaignListEntity();
  logAgainstEntity.EntityRSN = "Log against entity RSN string"; //Required
  logAgainstEntity.EntityType = "Person"; //Required - must be a valid entity
  emailSend.LogAgainstEntities = new AdministrationService.CampaignListEntity[] { logAgainstEntity };//Required

  var mergeEntity = new AdministrationService.CampaignListEntity();
  mergeEntity.EntityRSN = "Merge entity RSN string"; //Required
  mergeEntity.EntityType = "Person"; //Required - must be a valid entity
  emailSend.MergeEntities = new AdministrationService.CampaignListEntity[] { mergeEntity };//Optional

  var mergeField = new AdministrationService.MergeField();
  mergeField.FieldName = "WelcomeMessage"; //Required
  mergeField.FieldValue = "Hello John,"; //Required
  emailSend.MergeFields = new AdministrationService.MergeField[] { mergeField };//Optional

  request.Value = emailSend;//Required

  AdministrationService.ResultOflong result = svc.SendEmailFromTemplateForCampaignWithAttachments(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded
  }
  else
  {
    //Request failed          
    throw new Exception(result.FaultDescription);
  }
}
See Also