如何从 mailchimp 获取退订者电子邮件列表

发布于 2024-12-15 20:31:34 字数 2184 浏览 0 评论 0原文

我想获取退订者的电子邮件,下面的代码返回有多少退订者的计数,但是我如何从输出变量中获取退订者列表...

这是我的完整代码::

private List<campaignUnsubscribesResults.Unsubscribes> Unsubscribers = new List<campaignUnsubscribesResults.Unsubscribes>();

 private void GetUnsubscribers(string apikey, string MailChimpCampaignID)
        {

            campaignUnsubscribesInput input = new campaignUnsubscribesInput();
            input.api_AccessType = PerceptiveMCAPI.EnumValues.AccessType.Serial;
            input.api_CustomErrorMessages = true;
            input.api_MethodType = PerceptiveMCAPI.EnumValues.MethodType.POST;
            input.api_Validate = true;
            input.api_OutputType = PerceptiveMCAPI.EnumValues.OutputType.XML;
            input.parms.apikey = apikey;
            input.parms.cid = MailChimpCampaignID;

            //input.parms.start = PageIndex;
            //input.parms.limit = PageSize;

            campaignUnsubscribes unsubscribe = new campaignUnsubscribes();
            campaignUnsubscribesOutput output = unsubscribe.Execute(input);

            Unsubscribers.AddRange(output.result.data);
            string unsubscriber = "0";

            //ArrayList a = new ArrayList(); 
            //a[0] = output.result.data.ToString();
            //List<MCItem> lst = new List<MCItem>();

            //            foreach (listBatchUnsubscribeResults order in myArrayList)  
            //{  
            //     orders.add(order);  
            //} 
            string[] unsubs;

            //ArrayList [] list = new ArrayList [0];
            foreach (listMembers list1 in output.result)
            {
                unsubscriber = list1.ToString();
            }

            string unsubscribers = Unsubscribers.Count.ToString();

            Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Unsubscribers::  '+ ' " + unsubscribers + " ');</script>");
            //Unsubscribers.Reverse();
            //dlUnsubscribes.DataSource = Unsubscribers.Take(10);
            //dlUnsubscribes.DataBind();

            //dlUnsubscribes.Visible = (Unsubscribers.Count > 0);
        }

I want to get the emails of unsubscribers the code below returning the count that how many of it are there but how could i get the List of unsubscribers from output variable...

Here is my full code::

private List<campaignUnsubscribesResults.Unsubscribes> Unsubscribers = new List<campaignUnsubscribesResults.Unsubscribes>();

 private void GetUnsubscribers(string apikey, string MailChimpCampaignID)
        {

            campaignUnsubscribesInput input = new campaignUnsubscribesInput();
            input.api_AccessType = PerceptiveMCAPI.EnumValues.AccessType.Serial;
            input.api_CustomErrorMessages = true;
            input.api_MethodType = PerceptiveMCAPI.EnumValues.MethodType.POST;
            input.api_Validate = true;
            input.api_OutputType = PerceptiveMCAPI.EnumValues.OutputType.XML;
            input.parms.apikey = apikey;
            input.parms.cid = MailChimpCampaignID;

            //input.parms.start = PageIndex;
            //input.parms.limit = PageSize;

            campaignUnsubscribes unsubscribe = new campaignUnsubscribes();
            campaignUnsubscribesOutput output = unsubscribe.Execute(input);

            Unsubscribers.AddRange(output.result.data);
            string unsubscriber = "0";

            //ArrayList a = new ArrayList(); 
            //a[0] = output.result.data.ToString();
            //List<MCItem> lst = new List<MCItem>();

            //            foreach (listBatchUnsubscribeResults order in myArrayList)  
            //{  
            //     orders.add(order);  
            //} 
            string[] unsubs;

            //ArrayList [] list = new ArrayList [0];
            foreach (listMembers list1 in output.result)
            {
                unsubscriber = list1.ToString();
            }

            string unsubscribers = Unsubscribers.Count.ToString();

            Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Unsubscribers::  '+ ' " + unsubscribers + " ');</script>");
            //Unsubscribers.Reverse();
            //dlUnsubscribes.DataSource = Unsubscribers.Take(10);
            //dlUnsubscribes.DataBind();

            //dlUnsubscribes.Visible = (Unsubscribers.Count > 0);
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

§对你不离不弃 2024-12-22 20:31:34

我会使用 Mailchimp Webhooks。您在网站上设置一个页面/脚本,每次发生特定事件时 Mailchimp 都会调用该页面/脚本。当它是取消订阅事件时,您可以将要存储的信息记录到数据库、文件等中。

I would use Mailchimp Webhooks. You setup a page/script on your website which will get called by Mailchimp every time a particular event occurs. When it's an unsubscribe event, you can log the info you want to store to a database, file, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文