Saturday 12 July 2014

MAILCHIMP API INTEGRATION IN ASP.NET WITH C#

(SUBSCRIBER) MAILCHIMP API INTEGRATION IN ASP.NET WITH C#

1. Add PerceptiveMCAPI.ddl file in your solution. file download reference( http://perceptivemcapi.codeplex.com/releases/view/56923 )

2. Use below code for subscribe email.

 var fields = new Dictionary<string, object>
            {
                {"FNAME", firstname},               //Subscribe paramatere
                {"LNAME",lastname },
                {"CITY",city},
                {"STATE",state},
                {"ZIPCODE",zipcode},
                {"PHONE",phone},
            };
            listSubscribe cmd = new listSubscribe();
            listSubscribeParms newlistSubscribeParms = new listSubscribeParms
            {
                apikey = ConfigurationManager.AppSettings["apikey"],
                id = ConfigurationManager.AppSettings["Listid"],
                email_address = email,
                double_optin = false,
                email_type = EnumValues.emailType.html,
                replace_interests = true,
                send_welcome = Convert.ToBoolean(ConfigurationManager.AppSettings["sendwelcome"]),
                update_existing = Convert.ToBoolean(ConfigurationManager.AppSettings["updateexisting"]),
                merge_vars=fields,
            };
            listSubscribeInput newlistSubscribeInput = new listSubscribeInput(newlistSubscribeParms);

            var subscribeSuccess = cmd.Execute(newlistSubscribeInput);

1 comment: