Guest User

Untitled

a guest
Mar 12th, 2019
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. public string SendTriggerMail(string emailAddress,
  2. string subscriberKey,
  3. string triggerMailId)
  4. {
  5. IExactTargetService exactTargetServiceClient = new ExactTargetServiceClient
  6. {
  7. ClientCredentials = { UserName = { UserName = "", Password = "" } }
  8. };
  9.  
  10. var id = new ClientID { ID = 1234567, IDSpecified = true };
  11. var definition = new TriggeredSendDefinition
  12. {
  13. CustomerKey = triggerMailId,
  14. Client = id,
  15. FromAddress = "test@test.com",
  16. FromName = "Test",
  17. SendClassification = new SendClassification
  18. {
  19. SenderProfile = new SenderProfile
  20. {
  21. ReplyManagementRuleSet = new ReplyMailManagementConfiguration
  22. {
  23. EmailReplyAddress = "test@test.com",
  24. EmailDisplayName = "Test",
  25. }
  26. }
  27. }
  28. };
  29.  
  30. var send = new TriggeredSend { TriggeredSendDefinition = definition, Client = id };
  31.  
  32. var subscriber = new Subscriber
  33. {
  34. EmailAddress = emailAddress,
  35. SubscriberKey = subscriberKey
  36. };
  37.  
  38. var allAttributes = new List<Attribute>
  39. {
  40. new Attribute { Name = "SomeAttribute", Value = "AttributeValue" }
  41. };
  42.  
  43. subscriber.Attributes = allAttributes.ToArray();
  44.  
  45. send.Subscribers = new[] { subscriber };
  46. APIObject[] sends = { send };
  47.  
  48. var response = exactTargetServiceClient.Create(
  49. new CreateRequest(new CreateOptions(), sends));
  50.  
  51. return response.OverallStatus;
  52. }
Add Comment
Please, Sign In to add comment