Last active
June 27, 2018 09:56
-
-
Save FernandoVezzali/6038304 to your computer and use it in GitHub Desktop.
MailChimp example in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main() | |
{ | |
const string apiKey = "99999999999999999999999999999999-us2"; // Replace it before | |
const string listId = "b999jw9999"; // Replace it before | |
var options = new List.SubscribeOptions{DoubleOptIn = true,EmailType = List.EmailType.Html,SendWelcome = false}; | |
var merges = new List<List.Merges> { new List.Merges("[email protected]", List.EmailType.Html) { { "FNAME", "John" }, { "LNAME", "Smith" } } }; | |
var mcApi = new MCApi(apiKey, false); | |
var batchSubscribe = mcApi.ListBatchSubscribe(listId, merges, options); | |
if (batchSubscribe.Errors.Count > 0) | |
Console.WriteLine("Error:{0}", batchSubscribe.Errors[0].Message); | |
else | |
Console.WriteLine("Success"); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Fernardo!
I tried your code but is not working, in .NET side said that suscriber was added, but when i check in MailChimp List, the suscriber is not being added.
I download from nuget so in package config file i have the following:
I really appreciate if you can help me
Greetings from Chile!