Search code examples
c#asp.netmailchimp

Add new subscriber to list in mailchimp


I was wondering about how can I add new subscriber to mailchimp list using asp.net.

Here is the code I have which do nothing in that issue:

var entry = new Dictionary<string, object>();
entry.Add( "FNAME", "x");
entry.Add( "LNAME", "y" );
var lsi=new listSubscribeInput(apiKey,listId,"[email protected]",entry);
var ls=new listSubscribe(lsi);
ls.Execute();

Solution

  • Using the latest API (1.3) you can add a subscriber to a list using:

    // Subscribe the provided email to a list. 
    listSubscribe(string apikey, string id, string email_address, array merge_vars,
        string email_type, bool double_optin, bool update_existing,
        bool replace_interests, bool send_welcome);
    

    See MailChimp API.