22

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

有人有示例代码吗?

谢谢。

4

6 回答 6

16

下面的示例将发送一封选择加入的电子邮件:

首先安装 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<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();
    }
于 2013-07-19T10:37:20.370 回答
14

看看 CodePlex 上的 PerceptiveMCAPI:

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

http://perceptivemcapi.codeplex.com/

于 2011-04-27T13:09:17.380 回答
5

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

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

http://mandrillapp.com/

于 2012-05-04T23:47:56.780 回答
5

对于最新 的Mail Chimp 3.0 API的支持,您可以在以下位置找到 .Net 的包装器:

MailChimp.Net - Mail Chimp 3.0 包装器

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

于 2016-07-07T08:49:28.743 回答
4

你可以在 CodePlex 上试试这个:

麦卡皮网

于 2011-07-03T13:29:56.137 回答
3

请查看Dan Esparzahttps://github.com/danesparza/MailChimp.NET 您可以使用包管理器控制台安装包

安装包 MailChimp.NET

代码示例

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

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

您可以使用安装 Mandrill

安装包 Mandrill

代码示例

MandrillApi api = new MandrillApi("xxxxx-xxxx-xxxx-xxxx");
用户信息信息 = 等待 api.UserInfo();
于 2015-12-22T03:27:13.127 回答