如何在C#/ .Net中集成MailChimp

我想通过MailChimp发送电子邮件。 如何在.Net中这样做?

有没有人有示例代码?

谢谢。

看看CodePlex上的PerceptiveMCAPI:

PerceptiveMCAPI – Perceptive Logic用C#编写的MailChimp Api的.NET友好包装器。

http://perceptivemcapi.codeplex.com/

以下示例将发送选择加入电子邮件:

首先安装NuGet包:Install-Package mcapi.net

static void Main(string[] args) { const string apiKey = "6ea5e2e61844608937376d514-us2"; // Replace it before const string listId = "y657cb2495"; // Replace it before var options = new List.SubscribeOptions(); options.DoubleOptIn = true; options.EmailType = List.EmailType.Html; options.SendWelcome = false; var mergeText = new List.Merges("email@provider.com", List.EmailType.Text) { {"FNAME", "John"}, {"LNAME", "Smith"} }; var merges = new List { mergeText }; 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(); } 

尝试使用mailchimp的最新服务 – Mandrill(交易电子邮件服务)

你可以通过标准smtp或api使用它。

http://mandrillapp.com/

您可以在CodePlex上试试这个:

mcapinet

为了支持最新的 Mail Chimp 3.0 API ,您可以在.Net上找到包装:

MailChimp.Net – 邮件黑猩猩3.0包装

https://github.com/brandonseydel/MailChimp.Net

请查看Dan Esparza的 https://github.com/danesparza/MailChimp.NET您可以使用Package Manager控制台安装软件包

 安装包MailChimp.NET 

代码示例

  MailChimpManager mc = new MailChimpManager(“YourApiKeyHere-us2”);
 ListResult lists = mc.GetLists(); 

对于电子邮件发送和统计, Mailchimp提供Shawn Mclean的 Mandrill https://github.com/shawnmclean/Mandrill-dotnet

您可以使用安装Mandrill

 安装包Mandrill 

代码示例

  MandrillApi api = new MandrillApi(“xxxxx-xxxx-xxxx-xxxx”);
 UserInfo info = await api.UserInfo();