danesparza / MailChimp.NET

:envelope: .NET Wrapper for the MailChimp v2.0 API
MIT License
179 stars 119 forks source link

Subscribe question #148

Closed nikkifSV closed 9 years ago

nikkifSV commented 9 years ago

How long does it take for the subscribe to take effect? I am testing it locally and I can see it returning the email params, but when i try to get the just subscribed email, I get error saying it doesn't exists.. How do I know if an email was successfully subscribed when using your wrapper? The unsubscribe method returns the Complete value if success, but the subscribe one doesn't have that kind of response.. Thanks, N.

danesparza commented 9 years ago

Can you post the code you're using?

nikkifSV commented 9 years ago
                MailChimp.MailChimpManager mc = new MailChimp.MailChimpManager(sAPIKey.ToString());

                using (CustomerLogic myCustomerLogic = new CustomerLogic(ConnectionString))
                {
                     foreach (CustomerDO request in Customers.Customers)
                    {
                        //set customer values
                        MyMergeVar myMergeVars = new MyMergeVar();
                        myMergeVars.FirstName = request.CustomerFirstName;
                        myMergeVars.LastName = request.CustomerLastName;

                        if (request.CustomerThirdPartyEmailFlag == true)
                        {
                            if (sEmailListID.Trim().Length > 0)
                            {
                              if (!request.CustomerNoPromos)
              {
                                    EmailParameter email = new EmailParameter();
                                    email.Email = request.CustomerEmail.ToString();

                                    EmailParameter results = mc.Subscribe(sEmailListID.ToString(), email, myMergeVars);
              }
            }
            }
                    }
                }

After I run the code, The list doesn't show the added email... I then try to just do a simple ListResult lists = mc.GetLists();

        //  For each list
        foreach (var list in lists.Data)
        {
            //  Write out the list name:
            string l = list.Name;
            //  Get the first 100 members of each list:
            MembersResult results = mc.GetAllMembersForList(list.Id, "subscribed", 0, 100);
            foreach (var member in results.Data)
            {
                string t=member.Email;

//log emails here

            }
        }

and the email is not found either...

nikkifSV commented 9 years ago

Never mind. Found the issue.. I needed to set the doubleOptIn to false. Thanks!

danesparza commented 9 years ago

Awesome! I'm glad you figured it out!