Ejemplo n.º 1
0
        private static string Create_TBN_Generic_Against_EI_API(string emailAddress, string body01, string body02)
        {
            var newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = emailAddress;

            // addition of custom attributes
            newSubscriber.Attributes = new AzureTBNClientSDK.AzureServiceReference.Attribute[2];
            var attribute = new AzureTBNClientSDK.AzureServiceReference.Attribute();

            attribute.Name              = "Param001";
            attribute.Value             = body01;
            newSubscriber.Attributes[0] = attribute;

            attribute                   = new AzureTBNClientSDK.AzureServiceReference.Attribute();
            attribute.Name              = "Param002";
            attribute.Value             = body02;
            newSubscriber.Attributes[1] = attribute;

            /* Creating a new request*/
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName = "Generic";
            request.CustomerKey     = "AAD_Dashboard_Triggered_Send_001";

            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;

            request.Subscribers = new GenericSubscriber[1];
            // NOTE : the above can be changed to any other type of collection
            // by configuring the service reference to use
            // other collection types like List, Collection, ArrayList, etc
            request.Subscribers[0] = newSubscriber;

            EmailInterchangeResult results = EmailInterchangeResult.None;

            /*Instantiating the Proxy Class*/
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
            results = client.Send(request);

            return(results.ToString());
        }
Ejemplo n.º 2
0
        private static bool SendTriggeredWelcomeEmail(string address)
        {
            if (address == null)
            {
                return(false);
            }

            // Create the subscriber
            GenericSubscriber newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = address;
            // Create the request
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName   = "ResearchNews";
            request.CommunicationId   = 12345;
            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;
            request.Subscribers       = new GenericSubscriber[1];
            request.Subscribers[0]    = newSubscriber;

            EmailInterchangeResult result = EmailInterchangeResult.None;

            try
            {
                AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
                result = client.Send(request);

                return((result != EmailInterchangeResult.Success) ? false : true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occured sending the welcome email. " + ex);
            }

            return(false);
        }