如何将MailChimp整合到C#/。Net

问题描述:

我想通过MailChimp发送电子邮件。如何在.Net中做到这一点?如何将MailChimp整合到C#/。Net

是否有人有示例代码?

谢谢。

在PerceptiveMCAPI看看CodePlex上:

PerceptiveMCAPI - 一个.NET友好 包装为MailChimp API中的C#通过感知逻辑写 。

http://perceptivemcapi.codeplex.com/

+1

这里是一个使用ASP.NET MVC 3和PerceptiveMCAPI一个例子起始站点:https://github.com/otint/MailChimp-MVC3-PerceptiveMCAPI – Omri 2012-03-16 18:18:45

+0

我觉得PerceptiveMCAPI似乎不支持MCAPI 1.3。 ..有没有更好的选择...? – bhargav 2012-04-03 10:08:34

+0

PerceptiveMCAPI 1.3.0支持MCAPI 1.3,它已经在一年多的时间里进行了两次修订,并且运行良好。 – furtive 2012-09-06 22:53:50

你可以在CodePlex上试试这个:

mcapinet

尝试使用mailchimp的最新服务 - 山魈(事务的电子邮件服务)

您可以通过标准的SMTP使用它或api。

http://mandrillapp.com/

下面的例子将发送一个选择的电子邮件:

首先安装NuGet包:安装,包装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 protected]", List.EmailType.Text) 
        { 
         {"FNAME", "John"}, 
         {"LNAME", "Smith"} 
        }; 
     var merges = new List<List.Merges> { 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(); 
    } 
+1

这应该是正确的答案。迄今为止最快和最简单的方法。 – 2013-07-23 03:25:14

+1

我不认为这是可能了,不幸的是... – 2015-06-29 13:50:15

+0

提琴手表示这是发送到v1.3的API和3.0现在住现有的版本将不会在2016年后支持。哦,它没有出现工作无论如何 – wal 2016-10-19 12:17:03

通过丹 - 执行 - 检查出https://github.com/danesparza/MailChimp.NET Esparza 您可以使用软件包管理器控制台安装软件包

Install-Package MailChimp.NET

代码示例

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

对于电子邮件发送和统计,Mailchimp提供山魈通过肖恩·麦克莱恩https://github.com/shawnmclean/Mandrill-dotnet

您可以使用山魈安装

Install-Package Mandrill

代码示例

MandrillApi api = new MandrillApi("xxxxx-xxxx-xxxx-xxxx"); 
UserInfo info = await api.UserInfo();
+0

Dan Esparza现在在该项目页面上有一个注释,用于检查Brandon Seydel的v3(由Pranav的回答指出),因为这仅适用于已弃用的v2.0 API。 – ahwm 2017-05-26 16:31:19

的支持最新邮件黑猩猩3.0 API的,你可以找到包装为.NET:

MailChimp.Net - 邮件黑猩猩3。0包装

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

+1

支持最新的API和100%的覆盖率,谢谢 – 2017-02-21 15:09:17